finalizare 1.0
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using HealthcareManagerUiWebAssem.Entities;
|
||||
using HealthcareManagerUiWebAssem.Models;
|
||||
|
||||
namespace HealthcareManagerUiWebAssem.Services.AdminUserManagement;
|
||||
|
||||
public interface IAdminManagementService
|
||||
{
|
||||
Task<ApiResponse<List<Doctor>>> GetDoctors();
|
||||
Task<ApiResponse<List<Patient>>> GetPatients();
|
||||
Task<bool> DeleteDoctor(Guid id);
|
||||
Task<bool> DeletePatient(Guid id);
|
||||
}
|
||||
Reference in New Issue
Block a user