public HttpResponseMessage PutCustomer(int id, TEntityDto customerDto) { if (!ModelState.IsValid) { return(_requestProxy.CreateErrorResponse(this, HttpStatusCode.BadRequest, ModelState)); } if (id != customerDto.Id) { return(_requestProxy.CreateResponse(this, HttpStatusCode.BadRequest)); } TEntity customer = (TEntity)customerDto.ToEntity(); _entityStateSetter.SetState(_db, customer, EntityState.Modified); try { _db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(_requestProxy.CreateResponse(this, HttpStatusCode.InternalServerError)); } return(_requestProxy.CreateResponse(this, HttpStatusCode.OK)); }