public ActionResult Create(CommentModel model) { if (!ModelState.IsValid) { return(View(model)); } var comment = model.ToDbModel(); comment.AuthorId = User.Identity.GetUserId(); comment.Time = DateTime.Now; db.Comments.Add(comment); db.SaveChanges(); return(RedirectToAction("Details", new { id = comment.Id })); }