public async Task <IHttpActionResult> PutUser(int id, User user) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != user.Id) { return(BadRequest()); } db.Entry(user).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public bool UpdateInsurance(Insurance insurance) { bool success; try { context.Entry(insurance).State = EntityState.Modified; context.SaveChanges(); success = true; } catch { success = false; } return(success); }
public bool UpdateClient(Client client) { bool success; try { context.Entry(client).State = EntityState.Modified; context.SaveChanges(); success = true; } catch { success = false; } return(success); }