This commit is contained in:
Suphonchai Phoonsawat 2024-06-20 13:37:25 +07:00
parent 6c09c68c5c
commit 1ae6f5e8d1
23 changed files with 304 additions and 123 deletions

View file

@ -101,6 +101,27 @@ namespace BMA.EHR.Application.Repositories
}
}
protected async Task<bool> PostExternalAPIBooleanAsync(string apiPath, string accessToken, object? body)
{
try
{
var json = JsonConvert.SerializeObject(body);
var stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json");
stringContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
var _res = await client.PostAsync(apiPath, stringContent);
return _res.IsSuccessStatusCode;
}
}
catch
{
throw;
}
}
#endregion
public async Task<Guid> GetProfileOrganizationAsync(string citizenId)