void UCHomePageSectionMaintain_Loaded(object sender, RoutedEventArgs e) { if (_isEditing) { var maintainFacade = new HomePageSectionFacade(CPApplication.Current.CurrentPage); maintainFacade.Load(_editingSysNo.ToString(), (s, args) => { if (args.FaultsHandle()) { return; } _maintainVM = args.Result.Convert <HomePageSectionInfo, HomePageSectionMaintainVM>((info, vm) => { if (info.WebChannel != null) { vm.ChannelID = info.WebChannel.ChannelID; } }); this.DataContext = _maintainVM; LoadComboxData(); }); } else { _maintainVM = new HomePageSectionMaintainVM(); this.DataContext = _maintainVM; LoadComboxData(); } }
public void Update(HomePageSectionMaintainVM vm, EventHandler <RestClientEventArgs <object> > callback) { var entity = vm.ConvertVM <HomePageSectionMaintainVM, HomePageSectionInfo>(); entity.WebChannel = new WebChannel { ChannelID = vm.ChannelID }; entity.CompanyCode = CPApplication.Current.CompanyCode; string relativeUrl = "/MKTService/HomePageSection/Update"; restClient.Update(relativeUrl, entity, callback); }