on]")]
[ApiController]
public class AppointmentController : ControllerBase
{
private IAppointmentServices _appointmentServices;
public AppointmentController(IAppointmentServices appointmentServices)
{
_appointmentServices = appointmentServices;
}
[HttpGet]
public async Task<object> GetAppointments()
{
return await _appointmentServices.GetAppointments();
}
[HttpGet]
public async Task<object> GetAppointmentsByDoctorId(int doctorId)
{
return await _appointmentServices.GetAppointmentsByDoctorId(doctorId);
}
[HttpGet]
public async Task<object> GetAppointmentsByDoctorName(string doctorname)
{
return await _appointmentServices.GetAppointments(doctorname);
}
[HttpGet]
public async Task<object> GetAppointmentsByDate(DateOnly date)
{
return await _appointmentServices.GetAppointments(date);
}
[HttpGet]
public async Task<object> GetAppointmentsByAppointmentId(int appointmentId)
{
return await _appointmentServices.GetAppointments(appointmentId);
}
[HttpPost]
public async Task<object> ScheduleAppointment(Appointment appointment)
{
return _appointmentServices.ScheduleAppointment(appointment);
}
[HttpGet]
public async Task<object> ViewAppointmentByPatientId(int patientId)
{
return await _appointmentServices.ViewAppointment(patientId);
}
[HttpGet]
public async Task<object> ViewAppointmentByPatientName(string patientName)
{
return await _appointmentServices.ViewAppointment(patientName);
}
[HttpPut]
public async Task<object> UpdateAppointment(int id, int doctorId, DateOnly
rescheduleDate)
{
return _appointmentServices.UpdateAppointment(id, doctorId,
rescheduleDate);
}
[HttpDelete]
public async Task<object> CancelAppointment(int id)
{
return _appointmentServices.CancelAppointment(id);
}
[HttpGet]
public async Task<object> ViewAppointmentByDate(int patientId, DateOnly
date)
{
return _appointmentServices.ViewAppointment(patientId, date);
}
}
}