migrare UI in WebAssembly + integrare Serviciu stocare info pe web + WebToken
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using HealthcareManagerUiWebAssem.Models;
|
||||
|
||||
namespace HealthcareManagerUiWebAssem.Services.Profile;
|
||||
|
||||
public interface IProfileService
|
||||
{
|
||||
Task<BaseResponse> GetDoctors();
|
||||
|
||||
Task<BaseResponse> GetPatients();
|
||||
|
||||
Task<BaseResponse> GetDoctorById(Guid id);
|
||||
|
||||
Task<BaseResponse> GetPatientById(Guid id);
|
||||
|
||||
Task<BaseResponse> UpdateDoctorProfile(UserUpdateProfileModel userUpdateProfileModel);
|
||||
|
||||
Task<BaseResponse> UpdatePatientProfile(UserUpdateProfileModel userUpdateProfileModel);
|
||||
|
||||
Task<BaseResponse> DeleteDoctorProfile(Guid id);
|
||||
|
||||
Task<BaseResponse> DeletePatientProfile(Guid id);
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
using HealthcareManagerUiWebAssem.Models;
|
||||
using HealthcareManagerUiWebAssem.Services.Http;
|
||||
|
||||
namespace HealthcareManagerUiWebAssem.Services.Profile;
|
||||
|
||||
public class ProfileService : IProfileService
|
||||
{
|
||||
private readonly IRequestHttpService _requestHttpService;
|
||||
|
||||
public ProfileService(IRequestHttpService requestHttpService)
|
||||
{
|
||||
_requestHttpService = requestHttpService;
|
||||
}
|
||||
|
||||
public async Task<BaseResponse> GetDoctors()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _requestHttpService.GetAsync("/Doctors");
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.InternalServerError,
|
||||
Data = null,
|
||||
Message = ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BaseResponse> GetPatients()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _requestHttpService.GetAsync("/Patients");
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.InternalServerError,
|
||||
Data = null,
|
||||
Message = ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BaseResponse> GetDoctorById(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _requestHttpService.GetByIdAsync("/Doctors", id);
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.InternalServerError,
|
||||
Data = null,
|
||||
Message = ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BaseResponse> GetPatientById(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _requestHttpService.GetByIdAsync("/Patients", id);
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.InternalServerError,
|
||||
Data = null,
|
||||
Message = ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<BaseResponse> UpdateDoctorProfile(
|
||||
UserUpdateProfileModel userUpdateProfileModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _requestHttpService.PutAsync("/Doctors", userUpdateProfileModel);
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.InternalServerError,
|
||||
Data = null,
|
||||
Message = ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BaseResponse> UpdatePatientProfile(
|
||||
UserUpdateProfileModel userUpdateProfileModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _requestHttpService.PutAsync("/Patients", userUpdateProfileModel);
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.InternalServerError,
|
||||
Data = null,
|
||||
Message = ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BaseResponse> DeleteDoctorProfile(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _requestHttpService.DeleteAsync("/Doctors", id);
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.InternalServerError,
|
||||
Data = null,
|
||||
Message = ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BaseResponse> DeletePatientProfile(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _requestHttpService.DeleteAsync("/Patients", id);
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new BaseResponse
|
||||
{
|
||||
StatusCode = HttpStatusCodes.InternalServerError,
|
||||
Data = null,
|
||||
Message = ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user