public async Task <IActionResult> PutClient(int id, Client client) { if (id != client.Id) { return(BadRequest()); } _context.Entry(client).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <T> AddAsync(T entity, CancellationToken cancellationToken = default) { await DbContext.Set <T>().AddAsync(entity, cancellationToken); await DbContext.SaveChangesAsync(cancellationToken); return(entity); }
public async Task SaveChangesAsync() { await _context.SaveChangesAsync(); }