public IHttpActionResult PutEndereco(int id, Endereco endereco) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != endereco.Key) { return(BadRequest()); } db.Entry(endereco).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EnderecoExists(id)) { return(NotFound()); } else { throw; } } return(Ok("Update Realizado com sucesso!")); }
public virtual void Atualizar(TEntity model) { Context.Entry(model).State = EntityState.Modified; Save(model); }