Пример #1
0
 public static NonWorkingDay ToDomain(this NonWorkingDayViewModel model)
 {
     return(new NonWorkingDay
     {
         Id = model.Id,
         AcademyProgramId = model.AcademyProgramId,
         EventTypeId = model.EventTypeId,
         EventDate = model.EventDate
     });
 }
Пример #2
0
        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);
        }
Пример #3
0
 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));
     }
 }
Пример #4
0
 public void Create(NonWorkingDayViewModel model)
 {
     _nonWorkingDayRepository.Create(model.ToDomain());
 }