public void Delete(DrugCourseBindingModel model)
        {
            var element = _drugCourseStorage.GetElement(new DrugCourseBindingModel {
                Id = model.Id
            });

            if (element == null)
            {
                throw new Exception("Запись не найдена");
            }
            _drugCourseStorage.Delete(model);
        }
 public List <DrugCourseViewModel> Read(DrugCourseBindingModel model)
 {
     if (model == null)
     {
         return(_drugCourseStorage.GetFullList());
     }
     if (model.Id.HasValue)
     {
         return(new List <DrugCourseViewModel> {
             _drugCourseStorage.GetElement(model)
         });
     }
     return(_drugCourseStorage.GetFilteredList(model));
 }
        public void CreateOrUpdate(DrugCourseBindingModel model)
        {
            var element = _drugCourseStorage.GetElement(new DrugCourseBindingModel {
                FormedDate = model.FormedDate
            });

            if (element != null && element.Id != model.Id)
            {
                throw new Exception("Для данного времени уже существует запись");
            }
            if (model.Id.HasValue)
            {
                _drugCourseStorage.Update(model);
            }
            else
            {
                _drugCourseStorage.Insert(model);
            }
        }