public static NonWorkingDay ToDomain(this NonWorkingDayViewModel model) { return(new NonWorkingDay { Id = model.Id, AcademyProgramId = model.AcademyProgramId, EventTypeId = model.EventTypeId, EventDate = model.EventDate }); }
public void Update(NonWorkingDayViewModel model) { var day = _nonWorkingDayRepository.FindById(model.Id); if (day == null) { throw new Exception(); } day.AcademyProgramId = model.AcademyProgramId; day.EventTypeId = model.EventTypeId; day.EventDate = model.EventDate; _nonWorkingDayRepository.Update(day); }
public IActionResult UpdateNonWorkingDay(NonWorkingDayViewModel day) { try { if (!ModelState.IsValid) { throw new Exception(ModelState.ToString()); } _nonWorkingDayService.Update(day); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void Create(NonWorkingDayViewModel model) { _nonWorkingDayRepository.Create(model.ToDomain()); }