// GET: Projects/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var model = db.Projects.Find(id); if (model == null) { return(HttpNotFound()); } var projectPM = projectHelper.ListUserOnProjectInRole(model.Id, "ProjectManager"); if (projectPM.Count > 0) { ViewBag.ProjectManagers = new SelectList(roleHelper.UsersInRole("ProjectManager"), "Id", "FullName", projectPM.FirstOrDefault().Id); } else { ViewBag.ProjectManagers = new SelectList(roleHelper.UsersInRole("ProjectManager"), "Id", "FullName"); } ViewBag.DevelopersNotOnProject = new MultiSelectList(projectHelper.ListUserNotOnProjectInRole(model.Id, "Developer"), "Id", "FullName"); ViewBag.SubmittersNotOnProject = new MultiSelectList(projectHelper.ListUserNotOnProjectInRole(model.Id, "Submitter"), "Id", "FullName"); ViewBag.Submitters = new MultiSelectList(projectHelper.ListUserOnProjectInRole(model.Id, "Submitter"), "Id", "FullName"); ViewBag.Developers = new MultiSelectList(projectHelper.ListUserOnProjectInRole(model.Id, "Developer"), "Id", "FullName"); return(View(model)); }
public ActionResult Dashboard(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Ticket ticket = db.Tickets.Find(id); if (ticket == null) { return(HttpNotFound()); } if (ticketHelper.CanEditTicket(ticket.Id)) { ViewBag.TicketStatusId = new SelectList(db.TicketStatuses, "Id", "Name", ticket.TicketStatusId); ViewBag.TicketPriorityId = new SelectList(db.TicketPriorities, "Id", "Name", ticket.TicketPriorityId); ViewBag.TicketTypeId = new SelectList(db.TicketTypes, "Id", "Name", ticket.TicketTypeId); if (ticketHelper.CanEditTicketDev(ticket.Id)) { ViewBag.DeveloperId = new SelectList(projectHelper.ListUserOnProjectInRole(ticket.ProjectId, "Developer"), "Id", "FullName", ticket.Developer); } } return(View(ticket)); }