コード例 #1
0
 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;
 }
コード例 #2
0
        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;
            }));
        }
コード例 #3
0
        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;
            }));
        }