Manage Appointments DONE!
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using Application.Endpoints;
|
||||
using Application.Endpoints.Appointments;
|
||||
using Application.Services.Database;
|
||||
using Application.Services.Database.MongoDB;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace API.Controllers;
|
||||
|
||||
public class AppointmentsController : BaseApiController
|
||||
{
|
||||
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
|
||||
private readonly IPatientRepository _patientRepository;
|
||||
private readonly IDoctorRepository _doctorRepository;
|
||||
|
||||
public AppointmentsController(IAppointmentsMongoDbService appointmentsMongoDbService,
|
||||
IPatientRepository patientRepository, IDoctorRepository doctorRepository)
|
||||
{
|
||||
_appointmentsMongoDbService = appointmentsMongoDbService;
|
||||
_patientRepository = patientRepository;
|
||||
_doctorRepository = doctorRepository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<BaseResponse>> CreateAppointment(AppointmentManagementDto dto)
|
||||
{
|
||||
var handler = new AppointmentManagementHandler(_appointmentsMongoDbService, _patientRepository, _doctorRepository);
|
||||
var response = await handler.HandleCreateAppointment(dto).ConfigureAwait(false);
|
||||
return StatusCode(response.StatusCode, response);
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
public async Task<ActionResult<BaseResponse>> DeleteAppointment(AppointmentManagementDto dto)
|
||||
{
|
||||
var handler = new AppointmentManagementHandler(_appointmentsMongoDbService, _patientRepository, _doctorRepository);
|
||||
var response = await handler.HandleDeleteAppointment(dto).ConfigureAwait(false);
|
||||
return StatusCode(response.StatusCode, response);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user