private HomeViewModel BuildHomeModel() { var repo = new Repository(); var model = new HomeViewModel(); model.InitHomeViewModel(); model.nav.items = MapSectionContent(repo.GetSectionContentItems(SectionNames.Header)); model.homeImages.items = MapSectionContent(repo.GetSectionContentItems(SectionNames.HomeImages)); model.homeLinks.items = MapSectionContent(repo.GetSectionContentItems(SectionNames.HomeLinks)); model.menu.items = MapSectionContent(repo.GetSectionContentItems(SectionNames.Menu)); model.locations.items = MapSectionContent(repo.GetSectionContentItems(SectionNames.Location)); model.jobs.items = MapSectionContent(repo.GetSectionContentItems(SectionNames.Jobs)); model.footer.items = MapSectionContent(repo.GetSectionContentItems(SectionNames.Footer)); return model; }
public ActionResult EditContent(SectionContentModel contentModel) { var repo = new Repository(); repo.SaveSectionContent(contentModel.ToSectionContent()); switch (contentModel.Section) { case SectionNames.Header: return RedirectToAction("Navigation"); case SectionNames.Footer: return RedirectToAction("Footer"); case SectionNames.HomeImages: case SectionNames.HomeLinks: return RedirectToAction("Top"); case SectionNames.Jobs: return RedirectToAction("Jobs"); case SectionNames.Location: return RedirectToAction("Location"); case SectionNames.Menu: return RedirectToAction("Menu"); default: return RedirectToAction("Index"); } }
public ActionResult EditContent(int id) { var repo = new Repository(); var model = MapSectionContentItem(repo.GetSectionContentById(id)); return View("ContentEdit", model); }