/// <summary> /// Adds a new page to the context /// </summary> /// <param name="page"></param> /// <param name="listOfTags"></param> public void AddPage(Page page, string listOfTags) { // add blogPost to Context GetUnitOfWork.ContentContainers.AddObject(page); // add tags IEnumerable<string> formattedListOfTags = ExtractTagsFromString(listOfTags); AddListOfTagsToContentContainer(page, formattedListOfTags); }
/// <summary> /// Updates a page that has been modified. Deleting tag associations /// and adding new ones /// </summary> /// <param name="page"></param> /// <param name="listOfTags"></param> public void UpdatePage(Page page, string listOfTags) { UpdateTagsInContentContainer(page, listOfTags); }
/// <summary> /// Delete a page from the context /// </summary> /// <param name="entity"></param> public void Delete(Page page) { GetUnitOfWork.ContentContainers.DeleteObject(page); }
/// <summary> /// Adds a page to the context /// </summary> /// <param name="page"></param> public void Add(Page page) { GetUnitOfWork.ContentContainers.AddObject(page); }
/// <summary> /// Adds a page to the navigation bar /// </summary> /// <param name="page"></param> /// <param name="viewModel"></param> private void AddPageToNavBar(Page page, List<NavBarViewModel> viewModel) { viewModel.Add(new NavBarViewModel { NavLinkTitle = page.Title.ToLower(), NavLinkRoute = page.GetPageDetails() }); }
public ActionResult EditPage(Page pageEdited, string listOfTags) { // check validity if (!ModelState.IsValid) return View(pageEdited); // if it is valid, update changes Page page = BlogPostRepo.GetPageById(pageEdited.ContentID); TryUpdateModel(page); BlogPostRepo.UpdatePage(page, listOfTags); // BlogPostRepo.SubmitChanges(); TempData[vinCMS.Infraestructure.Constants.VIEW_MESSAGE] = SUCCESS_EDIT_PAGE; return RedirectToRoute(page.GetPageDetails()); }
public ActionResult CreatePage(Page page, string listOfTags) { // check validity if (!ModelState.IsValid) return View(page); // if it is valid, then we save the page and publish it BlogPostRepo.AddPage(page, listOfTags); // BlogPostRepo.SubmitChanges(); TempData[vinCMS.Infraestructure.Constants.VIEW_MESSAGE] = SUCCESS_PAGE_CREATE; return RedirectToRoute(page.GetPageDetails()); }