public void Create(CustomerGiftCreateVM vm, EventHandler <RestClientEventArgs <string> > callback) { List <CustomerGift> giftList = new List <CustomerGift>(); //原方法 采用SysNo判断 //foreach (var cid in vm.CustomerIDList) //{ // var gift = new CustomerGift(); // gift.CustomerSysNo = cid; // gift.ProductID = vm.ProductID; // gift.ProductSysNo = int.Parse(vm.ProductSysNo); // gift.Quantity = int.Parse(vm.Quantity); // gift.Status = CustomerGiftStatus.Origin; // giftList.Add(gift); //} //新方法 采用CustomerID判断 foreach (var cid in vm.CusIDList) { var gift = new CustomerGift(); gift.CustomerID = cid; gift.ProductID = vm.ProductID; gift.ProductSysNo = int.Parse(vm.ProductSysNo); gift.Quantity = int.Parse(vm.Quantity); gift.Status = CustomerGiftStatus.Origin; giftList.Add(gift); } string relativeUrl = "/CustomerService/Gift/Create"; restClient.Create <string>(relativeUrl, giftList, callback); }
private void InitNewViewModel() { this.LayoutRoot.DataContext = viewModel = new CustomerGiftCreateVM(); this.ButtonSave.IsEnabled = true; }