public HttpResponseMessage PutSales(Sale sale) { if (sale == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } try { db.Entry <Sale>(sale).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); var result = sale; return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Falha ao atualizar venda.")); } }
public void Update(User user) { _context.Entry <User>(user).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); }