public async Task <ActionResult> GetArchivedScheduleVersionModal(int?id, int scheduleVersion = 1) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } // load project from db, confirm that it's not null UserProjectsRepository repo = new UserProjectsRepository(); UserProjectViewModel viewModel = await repo.GetUserProjectWithSchedule(id, scheduleVersion); if (viewModel == null) { return(HttpNotFound()); } // authorize user ApplicationUser user = await ReturnCurrentUserAsync(); if (viewModel.ApplicationUserID == user.Id) { return(PartialView("_ArchivedScheduleVersion.Modal.GanttContainer", viewModel)); } Danger(unauthorizedAccessMessage, true); return(RedirectToAction("Index")); }
// GET: UserProjects/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } // load project from db, confirm that it's not null UserProjectsRepository repo = new UserProjectsRepository(); UserProjectViewModel viewModel = await repo.GetUserProjectWithSchedule(id, 1); // VersionNum = 1 for current schedule version if (viewModel == null) { return(HttpNotFound()); } // authorize user ApplicationUser user = await ReturnCurrentUserAsync(); if (viewModel.ApplicationUserID == user.Id) { return(View(viewModel)); } Danger(unauthorizedAccessMessage, true); return(RedirectToAction("Index")); }