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; })); }
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; }
// POST api/<controller> public HttpResponseMessage Post([FromBody] TiepNhanViewModel model) { return(Request.CreateResponse(HttpStatusCode.OK, model)); }
public ucTiepNhan() { InitializeComponent(); this.DataContext = ViewModel = new TiepNhanViewModel(); }