public ActionResult PostComment(int problemId, string commentText) { var userId = (int)Session["UserId"]; Comment newComment = new Comment(commentText, 0, userId, problemId); _commentRepo.AddComment(newComment); ProblemModel pm = new ProblemModel(); pm.Getproblem(problemId); return(RedirectToAction("Detail", new { id = problemId })); }
public ActionResult Detail(int id) { if ((int)Session["UserID"] == -1) { return(RedirectToAction("Login", "User")); } ProblemModel pm = new ProblemModel(); pm.Getproblem(id); return(View(pm)); }