Application.Web.Controllers.LaptopsController.PostComment C# (CSharp) Метод

PostComment() приватный Метод

private PostComment ( SubmitCommentModel commentModel ) : System.Web.Mvc.ActionResult
commentModel Application.Web.Models.SubmitCommentModel
Результат System.Web.Mvc.ActionResult
        public ActionResult PostComment(SubmitCommentModel commentModel)
        {
            if (ModelState.IsValid)
            {
                var currentUserName = this.User.Identity.GetUserName();
                var currentUserId = this.User.Identity.GetUserId();

                this.Data.Comments.Add(new Comment() {
                    AuthorId = currentUserId,
                    Content = commentModel.Comment,
                    LaptopId = commentModel.LaptopId
                });
                this.Data.SaveChanges();

                var viewModel = new CommentViewModel
                {
                    AuthorUserName = currentUserName,
                    Content = commentModel.Comment
                };
                return PartialView("_CommentPartial", viewModel);
            }
            else
            {
                // HttpResponceMessage needs using: using System.Net.Http;
                return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, ModelState.Values.First().ToString());
            }
        }
    }