api model use record

This commit is contained in:
2023-03-28 06:33:48 +08:00
parent b5e4d57772
commit 4d0f8e20a6
8 changed files with 68 additions and 175 deletions
+2 -7
View File
@@ -25,9 +25,7 @@ namespace SimApi.Controllers
[ApiExplorerSettings(IgnoreApi = true)]
public SimApiBaseResponse ExceptionHandler(int code)
{
var response = new SimApiBaseResponse();
response.SetCode(code);
return response;
return new SimApiBaseResponse(code);
}
/// <summary>
@@ -38,10 +36,7 @@ namespace SimApi.Controllers
public SimApiBaseResponse<string> CheckLogin()
{
ErrorWhenNull(LoginInfo, 401);
return new SimApiBaseResponse<string>
{
Data = LoginInfo.Id
};
return new SimApiBaseResponse<string>(LoginInfo.Id);
}
/// <summary>