add feat(): hello DB API
This commit is contained in:
parent
bcb66a3463
commit
39ab492bdb
@ -12,7 +12,9 @@ using NPOI.SS.UserModel;
|
|||||||
using NPOI.XSSF.UserModel;
|
using NPOI.XSSF.UserModel;
|
||||||
using Repository.BackendRepository.Interface;
|
using Repository.BackendRepository.Interface;
|
||||||
using Repository.FrontendRepository.Interface;
|
using Repository.FrontendRepository.Interface;
|
||||||
|
using Serilog;
|
||||||
using Serilog.Core;
|
using Serilog.Core;
|
||||||
|
using Serilog.Data;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
@ -63,9 +65,20 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
[Consumes("application/x-www-form-urlencoded")]
|
[Consumes("application/x-www-form-urlencoded")]
|
||||||
public async Task<ActionResult<ApiResult<TnToken>>> hellodb()
|
public async Task<ActionResult<ApiResult<TnToken>>> hellodb()
|
||||||
{
|
{
|
||||||
var User = await backendRepository.GetOneAsync<User>("userinfo", @$" deleted = 0");
|
ApiResult<TnToken> apiResult = new ApiResult<TnToken>(null);
|
||||||
return Ok(System.DateTime.Now.ToString() + @$"{User.full_name} OK !");
|
ErrorCode errorCode = new ErrorCode();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var User = await backendRepository.GetOneAsync<User>("userinfo", @$" deleted = 0");
|
||||||
|
return Ok(System.DateTime.Now.ToString() + @$" get user test: {User.full_name} OK !");
|
||||||
|
}
|
||||||
|
catch (Exception ex )
|
||||||
|
{
|
||||||
|
logger.LogError(ex.Message);
|
||||||
|
apiResult.Msg = ex.Message;
|
||||||
|
apiResult.Code = "9999";
|
||||||
|
return BadRequest(apiResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -101,6 +114,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
}
|
}
|
||||||
catch( Exception ex)
|
catch( Exception ex)
|
||||||
{
|
{
|
||||||
|
logger.LogError(ex.Message);
|
||||||
apiResult.Msg = ex.Message;
|
apiResult.Msg = ex.Message;
|
||||||
apiResult.Code = "9999";
|
apiResult.Code = "9999";
|
||||||
return BadRequest(apiResult);
|
return BadRequest(apiResult);
|
||||||
|
Loading…
Reference in New Issue
Block a user