Exemplo n.º 1
0
 public ActionResult Edit(BlogPostCommentAddViewModel model)
 {
     if (ModelState.IsValid)
     {
         blogPostCommentService.AddOrUpdate(model);
         return(RedirectToAction("Index")
                .WithSuccess(string.Format("The comment \"{0}\" has been updated".TA(), model.Name)));
     }
     return(View(model));
 }
Exemplo n.º 2
0
        public ActionResult AddPostComment(BlogPostCommentAddViewModel model)
        {
            //  var comment = Mapper.Map<BlogPostComment>(model);
            if (User.Identity.IsAuthenticated)
            {
                model.UserId = currentUser.User.Id;
                model.Name   = currentUser.User.FirstName;
                model.Email  = currentUser.User.Email;
            }

            blogPostCommentService.AddOrUpdate(model);
            var action = RedirectToAction("Post", new { id = model.BlogPostId });

            return(action.WithSuccess(string.Format("The comment has been added".TA())));
        }