public ActionResult Create(int id, int answerId, string description, string parentId, AuthenticatedUser user, HttpPostedFileBase file) { int pid = Convert.ToInt16(parentId); bool isRoot; if (parentId == "0") { isRoot = true; } else { isRoot = false; } string finalPath = Helpers.SaveFile(file, Server, "comments/"+id.ToString()+"/"); int newCommentId = Service.FactorCommentAdd(id, user.UserEntity, answerId, description, pid, finalPath); FactorCommentEntity comment = new FactorCommentEntity() { FactorCommentId = newCommentId, FactorId = answerId, Comment = description, DateCreated = System.DateTime.Now, UserId = user.UserEntity.Id, User = user.UserEntity, Path = finalPath }; CommentViewModel model = new CommentViewModel() { Comment = comment, User = user.UserEntity, IsRoot = isRoot }; return View("Comment", model); }
public ActionResult AnalysisHeader(int id, AuthenticatedUser user) { if (HttpContext.Cache["Report"] == null) HttpContext.Session["Report"] = Service.LoadReport(id); ViewBag.IsSFWStaff = user.UserEntity.IsSFWStaff; ReportEntity model = (ReportEntity)HttpContext.Session["Report"]; return View("_AnalysisHeader", model); }
public ViewResult Index(AuthenticatedUser user) { ReportsViewModel model = new ReportsViewModel() { Reports = Service.ReportList(user.UserEntity, ""), User = user.UserEntity }; return View("Index", model); }
public ActionResult CompleteReview(int id, AuthenticatedUser user) { //Service.UpdateReportStatus(id, 5); //5 = Internal Review 2 ReportEntity report = Service.LoadReport(id); HttpContext.Session["Report"] = report; string subject = "Report review complete"; string body = user.DisplayName + "has completed review of the following report:\n\n" + report.Title + "\n\n This report is now ready for Internal Review 2."; Helpers.SendMail(subject, body); TempData["Completed"] = true; Service.ReviewerReviewed(id, user.Id); return RedirectToAction("Index"); }
public ActionResult Index(int answerId, AuthenticatedUser user) { //The controller gets all the comments //The comments are in order //I might want to pass in two variables, comment and subcomments //Then we need a new view for subcomments inside the comment IList<FactorCommentEntity> comments = Service.FactorCommentGet(answerId); CommentsViewModel model = new CommentsViewModel() { Comments = comments, User = user.UserEntity }; return PartialView("_Comments", model); }
protected void Application_AuthenticateRequest(object sender, EventArgs e) { if (HttpContext.Current.User == null) return; if (!HttpContext.Current.User.Identity.IsAuthenticated) return; if (!(HttpContext.Current.User.Identity is FormsIdentity)) return; /* * 1. Model Bind Current<User> * 2. Chedk Httpcon for a non-null user * 3. Look up the user object by the valiue in iden.name * 4. create return new current<user> */ if (HttpContext.Current.User.Identity is FormsIdentity) { FormsIdentity identity = (FormsIdentity)HttpContext.Current.User.Identity; FormsAuthenticationTicket ticket = identity.Ticket; AuthenticatedUser user = new AuthenticatedUser(new ARTService().LoadUser(Convert.ToInt32(ticket.Name))); Context.User = new CustomPrincipal(new CustomIdentity<IAuthenticatedUser>(user)); } }
public ActionResult SubmitReport(int id, AuthenticatedUser user) { Service.UpdateReportStatus(id, 3); ReportEntity report = Service.LoadReport(id); HttpContext.Session["Report"] = report; string subject = "Report analysis ready for review"; string body = user.DisplayName + "has completed analysis of the following report:\n\n" + report.Title + "\n\n This report is now ready for Internal Review 1."; Helpers.SendMail(subject, body); return RedirectToAction("Index", "Dashboard"); }
public ActionResult UncompleteReview(int id, AuthenticatedUser user) { Service.ReviewerUnReviewed(id, user.Id); return RedirectToAction("Index"); }
public ViewResult Reports(string search, AuthenticatedUser user) { if (search == null || search == "") { return View("Reports", null); } ReportsViewModel model = new ReportsViewModel() { RecSummaries = PublicService.GetRecSummaries(search) }; ViewBag.specie = search; return View("Reports", model); }