public ActionResult Comment(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProjectStudentModels projectStudentModels = db.ProjectStudentModels.Find(id); string user_name = User.Identity.GetUserName(); if (projectStudentModels.StudentEmail != user_name) { return(HttpNotFound()); } var model = new ProjectCommentsViewModels() { Project = projectStudentModels, Comments = db.CommentModels.Where(m => m.ProjectId == id).ToList() }; if (projectStudentModels == null) { return(HttpNotFound()); } return(View(model)); }
public ActionResult Comment(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProjectStudentModels projectStudentModels = db.ProjectStudentModels.Find(id); var model = new ProjectCommentsViewModels() { Project = projectStudentModels, Comments = db.CommentModels.Where(m => m.ProjectId == id).ToList() }; if (projectStudentModels == null) { return(HttpNotFound()); } return(View(model)); }