refactor code
This commit is contained in:
parent
8ba9d349db
commit
ed1bb838ce
5 changed files with 109 additions and 67 deletions
|
|
@ -720,7 +720,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<dynamic> SearchProfile(string? citizenId, string? firstName, string? lastName, string accessToken, int page, int pageSize, string? role, string? nodeId, int? node)
|
||||
public async Task<GetProfileByKeycloakIdRootAddTotalDto> SearchProfile(string? citizenId, string? firstName, string? lastName, string accessToken, int page, int pageSize, string? role, string? nodeId, int? node)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -738,21 +738,21 @@ namespace BMA.EHR.Application.Repositories
|
|||
pageSize = pageSize,
|
||||
};
|
||||
|
||||
var profiles = new List<dynamic>();
|
||||
var profiles = new List<GetProfileByKeycloakIdRootDto>();
|
||||
var total = 0;
|
||||
|
||||
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<dynamic>(apiResult);
|
||||
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultAddTotalDto>(apiResult);
|
||||
if (raw != null && raw.Result != null)
|
||||
{
|
||||
profiles.AddRange(raw.Result.data);
|
||||
total = raw.Result.total;
|
||||
profiles.AddRange(raw.Result.Data);
|
||||
total = raw.Result.Total;
|
||||
}
|
||||
}
|
||||
|
||||
return new { data = profiles, total = total };
|
||||
return new GetProfileByKeycloakIdRootAddTotalDto { Data = profiles, Total = total };
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -760,7 +760,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<dynamic> SearchProfileEmployee(string? citizenId, string? firstName, string? lastName, string accessToken, int page, int pageSize, string? role, string? nodeId, int? node)
|
||||
public async Task<GetProfileByKeycloakIdRootAddTotalDto> SearchProfileEmployee(string? citizenId, string? firstName, string? lastName, string accessToken, int page, int pageSize, string? role, string? nodeId, int? node)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -778,21 +778,21 @@ namespace BMA.EHR.Application.Repositories
|
|||
pageSize = pageSize,
|
||||
};
|
||||
|
||||
var profiles = new List<dynamic>();
|
||||
var profiles = new List<GetProfileByKeycloakIdRootDto>();
|
||||
var total = 0;
|
||||
|
||||
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<dynamic>(apiResult);
|
||||
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultAddTotalDto>(apiResult);
|
||||
if (raw != null && raw.Result != null)
|
||||
{
|
||||
profiles.AddRange(raw.Result.data);
|
||||
total = raw.Result.total;
|
||||
profiles.AddRange(raw.Result.Data);
|
||||
total = raw.Result.Total;
|
||||
}
|
||||
}
|
||||
|
||||
return new { data = profiles, total = total };
|
||||
return new GetProfileByKeycloakIdRootAddTotalDto { Data = profiles, Total = total };
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue