public async Task <IActionResult> Create(SectionListViewModel model)
        {
            if (!string.IsNullOrEmpty(model.SectionName) && model.HallID != null)
            {
                _sectionService.AddSection(model.SectionName, model.HallID);
            }

            return(RedirectToAction(nameof(List), "Section"));
        }
Exemple #2
0
 public ActionResult AddSection(SectionModel section)
 {
     if (ModelState.IsValid)
     {
         sectionService.AddSection(section.ToBllSection());
         return(RedirectToAction("Sections", "Home"));
     }
     return(View(section));
 }
        public async Task <IActionResult> Create(Section section)
        {
            if (ModelState.IsValid)
            {
                var result = await _sectionService.AddSection(section);

                if (result.Status == ServiceResultStatus.Success)
                {
                    return(RedirectToAction(nameof(Index)));
                }
            }
            return(View(section));
        }
Exemple #4
0
        public async Task <ActionResult> AddSection(AddSectionNameModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await sectionService.AddSection(model);

                if (result)
                {
                    return(Ok());
                }
                else
                {
                    ModelState.AddModelError("error", "Секция с таким именем уже существует");
                }
            }
            return(BadRequest(ModelState));
        }