private async void SaveAction() { this.ProgressIsActive = true; var item = new ModelsShared.Models.customer { Address = this.Address, CityID = this.CityID, ContactName = this.ContactName, CustomerType = this.CustomerType, Email = this.Email, Handphone = this.Handphone, Id = this.Id, Name = this.Name, Phone1 = this.Phone1, Phone2 = this.Phone2 }; bool isSaved = await MainVM.CustomerCollection.Add(item); if (isSaved) { MainVM.CustomerCollection.SourceView.Refresh(); ModernDialog.ShowMessage("Data Is Saved !", "Information", System.Windows.MessageBoxButton.OK); this.Clear(); } else { ModernDialog.ShowMessage("Data Not Saved !", "Error", System.Windows.MessageBoxButton.OK); } this.ProgressIsActive = false; }
public CustomerEditVM(ModelsShared.Models.customer item) { this.MainVM = Common.ResourcesBase.GetMainWindowViewModel(); var t = Common.ResourcesBase.GetEnumCollection <ModelsShared.Models.CustomerType>(); CustomersTypes = (CollectionView)CollectionViewSource.GetDefaultView(t); Task.Factory.StartNew(() => SetItemToEdit(item)); }
private void SetItemToEdit(ModelsShared.Models.customer item) { this.Address = item.Address; this.ContactName = item.ContactName; this.CustomerType = item.CustomerType; this.Email = item.Email; this.Handphone = item.Handphone; this.Id = item.Id; this.Name = item.Name; this.Phone1 = item.Phone1; this.Phone2 = item.Phone2; this.CityID = item.CityID; }