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)); }