public static void UpdateGoiDichVu(this DanhMucGoiDichVuChung goidvchung, DanhMucGoiDichVuChungViewModel goidvchungVM) { goidvchung.RowIDGoiDichVuChung = goidvchungVM.RowIDGoiDichVuChung; goidvchung.IDGoiDichVuChung = goidvchungVM.IDGoiDichVuChung; goidvchung.TenGoiDichVuChung = goidvchungVM.TenGoiDichVuChung; goidvchung.ChietKhau = goidvchungVM.ChietKhau; goidvchung.DonGia = goidvchungVM.DonGia; }
public HttpResponseMessage Create(HttpRequestMessage request, DanhMucGoiDichVuChungViewModel dichvuVm) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } else { DanhMucGoiDichVuChung gdv = Mapper.Map <DanhMucGoiDichVuChungViewModel, DanhMucGoiDichVuChung>(dichvuVm); this.goiDichVuChungService.Add(gdv); goiDichVuChungService.Save(); response = request.CreateResponse(HttpStatusCode.Created, dichvuVm); } return response; })); }
public HttpResponseMessage Put(HttpRequestMessage request, DanhMucGoiDichVuChungViewModel goiDVChung) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } else { var goidichvudb = this.goiDichVuChungService.getByMa(goiDVChung.IDGoiDichVuChung); goidichvudb.UpdateGoiDichVu(goiDVChung); this.goiDichVuChungService.Update(goidichvudb); this.goiDichVuChungService.Save(); response = request.CreateResponse(HttpStatusCode.OK); } return response; })); }