public async Task <IHttpActionResult> PutClientModel(string id, ClientModel clientModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != clientModel.UserName) { return(BadRequest()); } db.Entry(clientModel).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientModelExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }