Esempio n. 1
0
        public virtual ActionResult Add(AddPageModel pageModel)
        {
            var newPage = new Page
            {
                Body = pageModel.Body.ToSafeHtml(),
                CommentStatus = pageModel.CommentStatus,
                CreatedDate = DateAndTime.GetDateTime(),
                Keyword = pageModel.Keyword,
                Order = pageModel.Order,
                Parent = _pageSerivce.Find(pageModel.ParentId.Value),
                Status = pageModel.Status,
                Title = pageModel.Title,
                User = _userService.Find(User.Identity.Name),
                Description = pageModel.Description
            };
            _pageSerivce.Add(newPage);
            _uow.SaveChanges();

            return PartialView(MVC.Admin.Shared.Views._Alert, new Alert
            {
                Message = "برگه جدید با موفقیت در سیستم ثبت شد",
                Mode = AlertMode.Success
            });
        }
Esempio n. 2
0
 public void Add(Page page)
 {
     _pages.Add(page);
 }
Esempio n. 3
0
 public void Update(Page page)
 {
     Page selectedPage = _pages.Find(page.Id);
     selectedPage.Body = page.Body;
     selectedPage.CommentStatus = page.CommentStatus;
     selectedPage.Description = page.Description;
     selectedPage.Keyword = page.Keyword;
     selectedPage.ModifiedDate = page.ModifiedDate;
     selectedPage.Order = page.Order;
     selectedPage.Parent = page.Parent;
     selectedPage.Status = page.Status;
     selectedPage.Title = page.Title;
     selectedPage.EditedByUser = page.EditedByUser;
 }
Esempio n. 4
0
 public virtual ActionResult Edit(EditPageModel pageModel)
 {
     var selectedPage = new Page
     {
         Body = pageModel.Body.ToSafeHtml(),
         CommentStatus = pageModel.CommentStatus,
         Description = pageModel.Description,
         EditedByUser = _userService.Find(User.Identity.Name),
         Keyword = pageModel.Keyword,
         ModifiedDate = DateAndTime.GetDateTime(),
         Id = pageModel.Id,
         Order = pageModel.Order,
         Parent = _pageSerivce.Find(pageModel.ParentId.Value),
         Status = pageModel.Status,
         Title = pageModel.Title
     };
     _pageSerivce.Update(selectedPage);
     _uow.SaveChanges();
     return PartialView(MVC.Admin.Shared.Views._Alert,
         new Alert { Message = "برگه مورد نظر با موفقیت ویرایش شد", Mode = AlertMode.Success });
 }