Пример #1
0
 public void EditPage(Page page)
 {
     var pageToEdit = GetPage(page.PageId);
     pageToEdit.OrderNumber = page.OrderNumber;
     pageToEdit.ParentId = page.ParentId;
     pageToEdit.Name = page.Name;
     pageToEdit.PageTypeId = page.PageTypeId;
     pageToEdit.UrlPath = page.UrlPath;
     _db.SaveChanges();
 }
Пример #2
0
 public int CreatePage(int parentId, string pageName, int position, int siteId)
 {
     var page = new Page();
     page.ParentId = parentId;
     page.Name = pageName;
     page.OrderNumber = position;
     page.PageTypeId = 1;
     page.SiteId = siteId;
     page.StartDate = DateTime.Now;
     page.EndDate = DateTime.MaxValue;
     _db.Page.Add(page);
     _db.SaveChanges();
     return page.PageId;
 }
Пример #3
0
 public void EditPage(Page page)
 {
     _pageManager.EditPage(page);
 }
Пример #4
0
 private void SaveOrder(Page page, int pageId, int newParentId, int orderNumber, List<Page> pages)
 {
     var isPageUpdated = false;
     var pagesToOrder = pages.Where(p => p.ParentId == newParentId && p.PageId != pageId).OrderBy(p => p.OrderNumber).ToList();
     var i = 1;
     foreach (var p in pagesToOrder)
     {
         if (orderNumber == i && page != null)
         {
             EditPage(PreparePage(page, orderNumber, newParentId));
             i++;
             isPageUpdated = true;
         }
         p.OrderNumber = i++;
         EditPage(p);
     }
     if (!isPageUpdated && page != null)
     {
         EditPage(PreparePage(page, orderNumber, newParentId));
     }
 }
Пример #5
0
 private Page PreparePage(Page page, int orderNumber, int parentId)
 {
     page.OrderNumber = orderNumber;
     page.ParentId = parentId;
     return page;
 }
Пример #6
0
 public void EditPage(Page page)
 {
     _pageRepository.EditPage(page);
 }
Пример #7
0
        public JsonResult Edit(Page page)
        {
            try
            {
                _pageHandler.EditPage(page);

                return Json(_pageHandler.GetPageViewModel(page.PageId));
            }
            catch
            {
                return Json(_pageHandler.GetPageViewModel(page.PageId));
            }
        }