public ActionResult Edit([Bind(Include = "Id,Title,Content,UserId,UserName")] Comment comment) { comment.UserId = User.Identity.GetUserId(); comment.UserName = User.Identity.GetUserName(); ModelState.Clear(); TryValidateModel(comment); if (ModelState.IsValid) { db.Entry(comment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(comment)); }