diff --git a/FrontendWebApi/ApiControllers/LoginController.cs b/FrontendWebApi/ApiControllers/LoginController.cs index 8a17ab1..f2d8757 100644 --- a/FrontendWebApi/ApiControllers/LoginController.cs +++ b/FrontendWebApi/ApiControllers/LoginController.cs @@ -12,7 +12,9 @@ using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; using Repository.BackendRepository.Interface; using Repository.FrontendRepository.Interface; +using Serilog; using Serilog.Core; +using Serilog.Data; using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; @@ -63,9 +65,20 @@ namespace FrontendWebApi.ApiControllers [Consumes("application/x-www-form-urlencoded")] public async Task>> hellodb() { - var User = await backendRepository.GetOneAsync("userinfo", @$" deleted = 0"); - return Ok(System.DateTime.Now.ToString() + @$"{User.full_name} OK !"); - + ApiResult apiResult = new ApiResult(null); + ErrorCode errorCode = new ErrorCode(); + try + { + var User = await backendRepository.GetOneAsync("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 @@ -101,6 +114,7 @@ namespace FrontendWebApi.ApiControllers } catch( Exception ex) { + logger.LogError(ex.Message); apiResult.Msg = ex.Message; apiResult.Code = "9999"; return BadRequest(apiResult);