public async Task <IActionResult> PutContato(int id, Contato contato) { if (id != contato.ContatoId) { return(BadRequest()); } _context.Update(contato); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContatoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public virtual TEntity Update(TEntity obj) { _context.Set <TEntity>(); _context.Update(obj); _context.SaveChanges(); return(obj); }