public async Task<ActionResult> Edit(SectionModel editingSection) { try { var section = _sectionrepository.FindById(editingSection.Id); section.Name = editingSection.Name; section.Header = editingSection.Header; section.Content = editingSection.Content; section.Description = editingSection.Description; section.OrderNumber = editingSection.OrderNumber; section.ParentSection = _sectionrepository.FindById(editingSection.SelectedParentSection); await _sectionrepository.UpdateAsync(section); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(SectionModel newSection) { try { var section = new Section { Name = newSection.Name, Header = newSection.Header, Content = newSection.Content, Description = newSection.Description, OrderNumber = newSection.OrderNumber, ParentSection = _sectionrepository.FindById(newSection.SelectedParentSection) }; _sectionrepository.Add(section); return RedirectToAction("Index"); } catch { return View(); } }