public HttpResponseMessage Update(HttpRequestMessage request, KhachHangViewModel khachhang) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } else { KhachHang NewKh = new KhachHang(); NewKh.UpdateKhachHang(khachhang); _khachHangService.Edit(NewKh); _khachHangService.SaveChange(); response = request.CreateResponse(HttpStatusCode.OK, khachhang); } return response; })); }