public async Task <IActionResult> ConfirmDeletion([Bind("Id,RTicketTitle,RTicketDescription,RTicketPriority,RTicketDate,RUsersName")] ResolvedTicket resolvedTicket) { if (ModelState.IsValid) { _context.Add(resolvedTicket); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(resolvedTicket)); }
/// <summary> /// Takes a ticket. /// Removes the ticket from the Database. /// Converts the ticket to a resolved ticket. /// Adds the resolved ticket to the resolved-ticket database. /// </summary> /// <param name="ticket"></param> public void ArchiveTicket(List <Ticket> tickets) { tickets.ForEach(ticket => { _context.Tickets.Remove(ticket); ResolvedTicket archiveTicket = new ResolvedTicket(); archiveTicket.TicketId = ticket.TicketId; archiveTicket.ItemId = ticket.ItemId; archiveTicket.AffectedService = ticket.AffectedService; archiveTicket.Descript = ticket.Descript; archiveTicket.TimeSubmitted = ticket.TimeSubmitted; _context.ResolvedTickets.Add(archiveTicket); _context.SaveChanges(); }); }