public ActionResult Details(Temp temp) { if (Session["Role"] != null) { if (Session["Role"].ToString() == "User") { Comment comment = new Comment { CommentBody = temp.CommentsList [0].CommentBody, UserName = temp.CommentsList [0].UserName, Time = DateTime.Now, PostId = temp.PostID }; commentsModel.AddComment(comment); return(RedirectToAction("Details")); } } else { return(RedirectToAction("Login", "Account")); } return(View()); }