public ScheduleTransfer(ScheduleToAddingDto scheduleDto, int doctorId) { DoctorId = doctorId; Monday = scheduleDto.Monday == null ? null : new WorkDay(scheduleDto.Monday); Tuesday = scheduleDto.Tuesday == null ? null : new WorkDay(scheduleDto.Tuesday); Wednesday = scheduleDto.Wednesday == null ? null : new WorkDay(scheduleDto.Wednesday); Thursday = scheduleDto.Thursday == null ? null : new WorkDay(scheduleDto.Thursday); Friday = scheduleDto.Friday == null ? null : new WorkDay(scheduleDto.Friday); Saturday = scheduleDto.Saturday == null ? null : new WorkDay(scheduleDto.Saturday); Sunday = scheduleDto.Sunday == null ? null : new WorkDay(scheduleDto.Sunday); IsApproved = false; }
public ControllerResponse AddNewSchedule([FromBody] ScheduleToAddingDto scheduleToAddingDto) { var doctorId = 0; if (User.Identity.IsAuthenticated) { doctorId = int.Parse(User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value); } if (!scheduleToAddingDto.ValidateScheduleForAdd()) { return(ControllerResponse.Warning("Данные были не введены или введены не полностью, повторите запрос")); } _doctorServices.AddNewSchedule(new ScheduleTransfer(scheduleToAddingDto, doctorId)); return(ControllerResponse.Ok()); }
/// <summary> /// Техническая валидация данных графика работы /// </summary> public static bool ValidateScheduleForAdd(this ScheduleToAddingDto scheduleDto) { return(scheduleDto.ValidationOnNull()); }