Articles.Web.Controllers.CommentsController.Create C# (CSharp) Method

Create() private method

private Create ( int id, CommentModel model ) : IHttpActionResult
id int
model Articles.Web.Models.CommentModel
return IHttpActionResult
        public IHttpActionResult Create(int id, CommentModel model)
        {
            var userId = this.User.Identity.GetUserId();
            var comment = new Comment
            {
                ArticleId = id,
                AuthorId = userId,
                Content = model.Content,
                DateCreated = DateTime.Now
            };

            this.data.Comments.Add(comment);
            this.data.SaveChanges();
            return Ok();
        }
    }