public ActionResult <Ticket> Delete(int id) { var objTicket = context.ticket.FirstOrDefault(x => x.id == id); if (objTicket == null) { return(NotFound()); } context.Remove(objTicket); context.SaveChanges(); return(Ok()); }
public bool RemoveById(int Id) { var dbTicket = _ticketDbContext.Tickets.FirstOrDefault(i => i.Id == Id); try { _ticketDbContext.Remove(dbTicket); _ticketDbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }