public IActionResult DeleteTicket(DeleteTicketRequest request)
 {
     if (request == null)
     {
         return(BadRequest());
     }
     return(Ok(ticketRepository.DeleteTicket(request)));
 }
Esempio n. 2
0
        public async Task <bool> DeleteTicket(NetConnection connection)
        {
            if (queuedTickets.ContainsKey(connection))
            {
                var ticket  = queuedTickets[connection];
                var request = new DeleteTicketRequest()
                {
                    TicketId = ticket.Id
                };

                await client.DeleteTicketAsync(request);

                queuedTickets.Remove(connection);

                return(true);
            }

            return(false);
        }
 public bool DeleteTicket(DeleteTicketRequest request)
 {
     if (request != null)
     {
         var ticket    = _db.Tickets.Where(a => a.Id == request.TicketId).FirstOrDefault();
         var UpdateLog = _db.Logs.Where(a => a.ticketId == ticket.Id).ToList();
         if (UpdateLog.Count != 0)
         {
             foreach (var updateLog in UpdateLog)
             {
                 Nullable <int> i = null;
                 updateLog.ticketId     = i;
                 updateLog.LastModified = DateTime.Now;
                 //Remove the ticket reference in log table and save
                 _db.SaveChanges();
             }
             //remove the requested ticket
             _db.Tickets.Remove(ticket);
             _db.SaveChanges();
             return(true);
         }
     }
     return(false);
 }