// GET: /Edit public ActionResult Edit(int id) { //AccessRights TicketQueueItem ticketQueueItem = new TicketQueueItem(); ticketQueueItem = ticketQueueItemRepository.GetItem(id); //Check Exists if (ticketQueueItem == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToTicketQueueGroup(ticketQueueItem.TicketQueueGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } TicketTypeRepository ticketTypeRepository = new TicketTypeRepository(); SelectList ticketTypeList = new SelectList(ticketTypeRepository.GetAllTicketTypes().ToList(), "TicketTypeId", "TicketTypeDescription"); ViewData["TicketTypes"] = ticketTypeList; GDSRepository gdsRepository = new GDSRepository(); SelectList gdsList = new SelectList(gdsRepository.GetAllGDSs().ToList(), "GDSCode", "GDSName"); ViewData["GDSs"] = gdsList; //Parent Information ViewData["TicketQueueGroupId"] = ticketQueueItem.TicketQueueGroupId; ViewData["TicketQueueGroupName"] = ticketQueueGroupRepository.GetGroup(ticketQueueItem.TicketQueueGroupId).TicketQueueGroupName; //Add Linked Information ticketQueueItemRepository.EditItemForDisplay(ticketQueueItem); //Show To User return(View(ticketQueueItem)); }
// GET: /Create public ActionResult Create(int Id) { //Get WorkFlowGroup TicketQueueGroup ticketQueueGroup = new TicketQueueGroup(); ticketQueueGroup = ticketQueueGroupRepository.GetGroup(Id); //Check Exists if (ticketQueueGroup == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToTicketQueueGroup(Id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } TicketTypeRepository ticketTypeRepository = new TicketTypeRepository(); SelectList ticketTypeList = new SelectList(ticketTypeRepository.GetAllTicketTypes().ToList(), "TicketTypeId", "TicketTypeDescription"); ViewData["TicketTypes"] = ticketTypeList; GDSRepository gdsRepository = new GDSRepository(); SelectList gdsList = new SelectList(gdsRepository.GetAllGDSs().ToList(), "GDSCode", "GDSName"); ViewData["GDSs"] = gdsList; TicketQueueItem ticketQueueItem = new TicketQueueItem(); ticketQueueItem.TicketQueueGroupId = ticketQueueGroup.TicketQueueGroupId; ticketQueueItem.TicketQueueGroupName = ticketQueueGroup.TicketQueueGroupName; return(View(ticketQueueItem)); }