finalizare 1.0

This commit is contained in:
andrei-mihnea-cerbu
2024-05-21 12:10:53 +03:00
parent f7795f7519
commit 1cc1d34003
11268 changed files with 2102399 additions and 10909 deletions
@@ -0,0 +1,38 @@
using System.Net.Http.Json;
using System.Text.Json;
using HealthcareManagerUiWebAssem.Entities;
using HealthcareManagerUiWebAssem.Models;
using HealthcareManagerUiWebAssem.Services.RequestHttp;
namespace HealthcareManagerUiWebAssem.Services.AdminUserManagement;
public class AdminManagementService(IRequestHttpService requestHttpService) : IAdminManagementService
{
public async Task<ApiResponse<List<Doctor>>> GetDoctors()
{
var response = await requestHttpService.GetAsync("/api/Doctors");
var responseContent = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<ApiResponse<List<Doctor>>>(responseContent,
new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
}
public async Task<ApiResponse<List<Patient>>> GetPatients()
{
var response = await requestHttpService.GetAsync("/api/Patients");
var responseContent = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<ApiResponse<List<Patient>>>(responseContent,
new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
}
public async Task<bool> DeleteDoctor(Guid id)
{
var response = await requestHttpService.DeleteAsync($"/api/Doctors/{id}");
return response.IsSuccessStatusCode;
}
public async Task<bool> DeletePatient(Guid id)
{
var response = await requestHttpService.DeleteAsync($"/api/Patients/{id}");
return response.IsSuccessStatusCode;
}
}