public HttpResponseMessage Create(HttpRequestMessage request, TiepNhanViewModel TiepNhanVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var tiepNhan = new TiepNhan();
                    tiepNhan.UpdateTiepNhan(TiepNhanVM);

                    this.tiepNhanService.AddUpd(tiepNhan);
                    foreach (var chitietVm in TiepNhanVM.lstTiepNhanVM)
                    {
                        var tiepnhan = new TiepNhan();
                        tiepNhan.UpdateTiepNhan(TiepNhanVM);
                        this.tiepNhanService.AddUpd(tiepnhan);
                    }
                    this.tiepNhanService.Save();
                    response = request.CreateResponse(HttpStatusCode.Created);
                }

                return response;
            }));
        }
示例#2
0
 public static void UpdateTiepNhan(this TiepNhan tiepNhan, TiepNhanViewModel tiepnhanVM)
 {
     tiepNhan.isDaDanhGia   = tiepnhanVM.isDaDanhGia;
     tiepNhan.isDaNhapLieu  = tiepnhanVM.isDaNhapLieu;
     tiepNhan.MaDonVi       = tiepnhanVM.MaDonVi;
     tiepNhan.MaDVCS        = tiepnhanVM.MaDVCS;
     tiepNhan.MaNVTiepNhan  = tiepnhanVM.MaNVTiepNhan;
     tiepNhan.MaPhieu       = tiepnhanVM.MaPhieu;
     tiepNhan.MaTiepNhan    = tiepnhanVM.MaTiepNhan;
     tiepNhan.MaTrungTam    = tiepnhanVM.MaTrungTam;
     tiepNhan.NgayTiepNhan  = tiepnhanVM.NgayTiepNhan;
     tiepNhan.RowIDPhieu    = tiepnhanVM.RowIDPhieu;
     tiepNhan.RowIDTiepNhan = tiepnhanVM.RowIDTiepNhan;
 }
示例#3
0
 // POST api/<controller>
 public HttpResponseMessage Post([FromBody] TiepNhanViewModel model)
 {
     return(Request.CreateResponse(HttpStatusCode.OK, model));
 }
示例#4
0
 public ucTiepNhan()
 {
     InitializeComponent();
     this.DataContext = ViewModel = new TiepNhanViewModel();
 }