Esempio n. 1
0
 public ActionResult EditPage(EditPageViewModel model)
 {
     if (!this.ModelState.IsValid)
         return View(model);
     var pages = _service.GetNavigation();
     var page = model.Inserting() ? new PageNavigation { ParentId = model.ParentId } : pages.Single(p => p.Id == model.NavigationModel.Page.PageNavigation.Id);
     model.Page.PageNavigation.TransferTo(page);
     if (model.Inserting())
     {
         page.Id = pages.Max(p => p.Id) + 1;
         pages.Add(page);
     }
     _service.SaveNavigation(pages);
     Message("Page Saved");
     return RedirectToAction("Index", new { id = page.Id });
 }
Esempio n. 2
0
 public ActionResult MovePage(EditPageViewModel model)
 {
     //var pageToMove = _service.GetPage(model.NavigationModel.Page.PageNavigation.Id);
     var newPage = _service.MovePageToChildPage(model.NavigationModel.Page.PageNavigation.Id);
     Message("A new page has been added.");
     return RedirectToAction("Index", new { id = newPage.PageNavigation.Id });
 }
Esempio n. 3
0
 public ActionResult EditPage(int? pageId, int? parentId)
 {
     var id = pageId.HasValue ? pageId.Value : parentId.Value;
     var page = _service.GetPage(id);
     var model = new EditPageViewModel
     {
         ParentId = parentId,
         PageId = pageId,
         NavigationModel = HomeIndexViewModelLoader.Create(id, _service)
     };
     model.Page = model.Inserting() ? new Page {PageNavigation =  new PageNavigation{ParentId = parentId} } : page;
     return View(model);
 }