public async Task <IActionResult> PutTicket([FromRoute] int id, [FromBody] Ticket ticket) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ticket.Id) { return(BadRequest()); } _context.Entry(ticket).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TicketExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public virtual T Update(T entity) { _context.Entry(entity).State = EntityState.Modified; return(entity); }