Ejemplo n.º 1
0
        public async Task <ActionResult> NewComment(NewCommentModel model)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Post", new { id = model.PostId }));
            }

            var blogContext = new BlogContext();
            await blogContext.CommentToPost(model.PostId, model.Content, this.User.Identity.Name);

            // XXX WORK HERE
            // add a comment to the post identified by model.PostId.
            // you can get the author from "this.User.Identity.Name"

            return(RedirectToAction("Post", new { id = model.PostId }));
        }