public ActionResult CreateLectureFlow(LectureFlowViewModel lectureFlowViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var lectureFlowDTO = new LectureFlowDTO
                    {
                        Title = lectureFlowViewModel.Title
                    };

                    lectureFlowService.CreateLectureFlow(lectureFlowDTO);

                    TempData["message"] = string.Format("Поток был была добавлена");

                    return(RedirectToAction("index"));
                }
            }
            catch (ValidationException ex)
            {
                ModelState.AddModelError(ex.Property, ex.Message);
            }

            return(View(lectureFlowViewModel));
        }
Example #2
0
        public void CreateLectureFlow(LectureFlowDTO lectureFlowDTO)
        {
            if (lectureFlowDTO == null)
            {
                throw new ValidationException("Введите данные", "");
            }

            LectureFlow lectureFlow = new LectureFlow
            {
                Title = lectureFlowDTO.Title,
            };

            Database.LectureFlows.Create(lectureFlow);
            Database.Save();
        }