public async void Schedule_Appointment_Not_Valid(SchedulingAppointmentDto appointment, HttpStatusCode expectedResponseStatusCode) { HttpClient client = factory.CreateClient(); HttpResponseMessage response = await client.PostAsync("/api/appointment/", new StringContent(JsonConvert.SerializeObject(appointment), Encoding.UTF8, "application/json")); response.StatusCode.ShouldBeEquivalentTo(expectedResponseStatusCode); }
[HttpPost] // POST /api/appointment/ public IActionResult ScheduleAppointment(SchedulingAppointmentDto dto) { if (App.Instance().DoctorWorkDayService.ScheduleAppointment(SchedulingAppointmentMapper.AppointmentDtoToAppointment(dto))) { return(Ok()); } return(NotFound()); }
public static Appointment AppointmentDtoToAppointment(SchedulingAppointmentDto dto) { Appointment appointment = new Appointment(); appointment.Canceled = dto.Canceled; appointment.DoctorWorkDayId = dto.DoctorWorkDayId; appointment.StartTime = dto.StartTime; appointment.EndTime = dto.EndTime; appointment.MedicalExamination = dto.MedicalExamination; appointment.MedicalExamination.PatientId = 1; return(appointment); }