public IActionResult Index() { var viewModel = new EditSectionViewModel { AllSections = this.editSectionService.GetAllSections(), }; var model = new EditSectionBaseModel { EditSectionInputModel = new EditSectionInputModel(), EditSectionViewModel = viewModel, }; return(this.View(model)); }
public async Task <IActionResult> EditSection(EditSectionBaseModel model) { if (this.ModelState.IsValid) { await this.editSectionService.EditSection(model.EditSectionInputModel); this.TempData["Success"] = string.Format( MessageConstants.SuccessfullyEditSection, model.EditSectionInputModel.Name); return(this.RedirectToAction("Index", "EditSection")); } else { this.TempData["Error"] = MessageConstants.InvalidInputModel; return(this.RedirectToAction("Index", "EditSection", model)); } }