Пример #1
0
        public virtual ActionResult Add(AddUpdateArticleModel model)
        {
            _articleService.Add(new Article
            {
                Body = model.Body.ToSafeHtml(),
                Category = _categoryService.Find(model.CategoryId),
                CommentStatus = model.CommentStatus,
                CreatedDate = DateAndTime.GetDateTime(),
                Description = model.Description,
                Keyword = model.Keywords,
                LikeCount = 0,
                Status = model.ArticleStatus,
                Title = model.Title,
                User = _userService.Find(User.Identity.Name),
                VisitedCount = 0,
            });

            _uow.SaveChanges();

            return PartialView(MVC.Admin.Shared.Views._Alert, new Alert
            {
                Message = "مطلب جدید با موفقیت در سیستم ثبت شد",
                Mode = AlertMode.Success
            });
        }
Пример #2
0
 public virtual ActionResult Edit(AddUpdateArticleModel model)
 {
     var selectedArticle = new Article
     {
         Body = model.Body.ToSafeHtml(),
         Category = _categoryService.Find(model.CategoryId),
         CommentStatus = model.CommentStatus,
         Description = model.Description,
         EditedByUser = _userService.Find(User.Identity.Name),
         Id = model.Id,
         Keyword = model.Keywords,
         ModifiedDate = DateAndTime.GetDateTime(),
         Status = model.ArticleStatus,
         Title = model.Title,
     };
     _articleService.Update(selectedArticle);
     _uow.SaveChanges();
     return PartialView(MVC.Admin.Shared.Views._Alert,
         new Alert { Message = "مطلب مورد نظر با موفقیت ویرایش شد", Mode = AlertMode.Success });
 }