/// <summary> /// Creates a new window to edit the currently selected customer. /// </summary> public void EditLocationExecute() { try { LocationViewModel viewModel = this.AllLocations.SingleOrDefault(vm => vm.IsSelected); if (viewModel != null) { this.ShowLocation(viewModel); this.repositorys.SaveToDatabase(); } else if (viewModel == null) { MessageBox.Show("Please select an item first."); } } catch (InvalidOperationException) { MessageBox.Show("Select 1 item only."); } }
/// <summary> /// Creates a new product execute. /// </summary> private void CreateNewLocationExecute() { LocationViewModel viewModel = new LocationViewModel(new Location(), this.repo); ShowLocation(viewModel); }