Example #1
0
        public ActionResult AddComment(CommentInputModel input)
        {
            if (ModelState.IsValid)
            {
                var addCommentCmd = Mapper.Map <AddCommentCommand>(input);

                CommandProcessor.Process(addCommentCmd);

                if (addCommentCmd.IsValid)
                {
                    Notify("Your comment has been received!", NotifyType.Success, NotifyPosition.Top);

                    return(RedirectToAction("Show", new { id = input.PostId }));
                }

                ModelState.AddValidationResults(addCommentCmd.ValidationResults());
            }

            return(RedirectToAction("Show", new { id = input.PostId }));
        }