public ActionResult CreateComment() { Commentdb commentdb = new Commentdb() { }; return(View(commentdb)); }
public ActionResult CreateComment(Commentdb model) { if (ModelState.IsValid) { model.Created = DateTime.Now; // int Studentid; int.TryParse(Session["StudentId"].ToString(), out Studentid); model.StudentId = Studentid; // int PostId; int.TryParse(Session["PostId"].ToString(), out PostId); model.PostId = PostId; // model.Created = DateTime.Now; // repositoryComment.Create(model); repositoryComment.Save(); return(RedirectToAction("Details", new { id = model.PostId })); } return(View(model)); }