public ActionResult FullProject(int id = -1) { if (RouteData.Values["id"] != null) { if (int.TryParse(RouteData.Values["id"].ToString(), out id)) { } } Project p = new Project(); if (id != -1) { p = db.retrieveProject(id); if (p == null) { string error1 = "The Portfolio you tried to view either does not exist or could not be found."; string error2 = "Portfolio Id: " + id; TempData["ErrorMessages"] = new string[] { error1, error2 }; return RedirectToAction("Http404", "Error"); } } VMFullProject project = new VMFullProject(p); return View(model: project); }
public ActionResult CollaboratorManagement(int id = -1) { #region verifying project id & project editing permissions if (RouteData.Values["id"] != null) { if (int.TryParse(RouteData.Values["id"].ToString(), out id)) { } } Project project; if (id != -1) { project = db.retrieveProject(id); if (project == null) { string error1 = "The Project whose collaborators you tried to manage either does not exist or could not be found."; string error2 = "Project Id: " + id; TempData["ErrorMessages"] = new string[] { error1, error2 }; return RedirectToAction("Http404", "Error"); } } else { string error1 = "A project Id is required to manage a project's collaborators."; TempData["ErrorMessages"] = new string[] { error1 }; return RedirectToAction("Http404", "Error"); } VMFullProject vmProj = new VMFullProject(project); if (!vmProj.ProjectEditorIds.Any(editorId => editorId == WebSecurity.CurrentUserId) && !User.IsInRole("Admin"))//If user trying to edit project is not a project editor or admin { string error1 = "You do not have permission to edit this project."; string error2 = "To edit your contribution to the project, please do so from your project catalog via the edit button."; string error3 = "If you are not registered as a contributor to this project, either add/request to add yourself as one, or contact a project editor for that project."; string error4 = "If you are the original creator of this project or otherwise believe that you have reached this page in error, please see the Support page to submit a report."; string error5 = "For mor information on Projects, Project Permissions, Project Editors, and Project Collaborators, please see the FAQ or Glossary page."; TempData["ErrorMessages"] = new string[] { error1, error2, error3, error4, error5 }; return RedirectToAction("General", "Error"); } #endregion if (TempData["AddCollabError"] != null) { ViewBag.AddCollabError = TempData["AddCollabError"]; TempData["AddCollabError"] = null; } return View(model: vmProj); }