public void Create(SaleAdvertisementVM vm, EventHandler <RestClientEventArgs <SaleAdvertisementVM> > callback) { string relativeUrl = "/MKTService/SaleAdvTemplate/Create"; var msg = vm.ConvertVM <SaleAdvertisementVM, SaleAdvertisement>(); msg.Name.Content = vm.Name; msg.CompanyCode = CPApplication.Current.CompanyCode; restClient.Create <SaleAdvertisement>(relativeUrl, msg, (obj, args) => { if (args.FaultsHandle()) { return; } vm.SysNo = args.Result.SysNo; RestClientEventArgs <SaleAdvertisementVM> e = new RestClientEventArgs <SaleAdvertisementVM>(vm, this.viewPage); callback(obj, e); }); }
public void Update(SaleAdvertisementVM vm, EventHandler <RestClientEventArgs <SaleAdvertisementVM> > callback) { string relativeUrl = "/MKTService/SaleAdvTemplate/Update"; var msg = vm.ConvertVM <SaleAdvertisementVM, SaleAdvertisement>(); msg.Name.Content = vm.Name; restClient.Update <SaleAdvertisement>(relativeUrl, msg, (obj, args) => { if (args.FaultsHandle()) { return; } RestClientEventArgs <SaleAdvertisementVM> e = new RestClientEventArgs <SaleAdvertisementVM>(vm, this.viewPage); callback(obj, e); }); }