private void New_Executed() { this.Persons.Add(new PersonViewModel(new Person())); this.SelectedPerson = this.persons.Last(); this.editCommand.Execute(null); }
private void Cancel_Executed() { if (this.selectedPerson.Id == 0) { this.persons.Remove(this.selectedPerson); this.SelectedPerson = null; // Select last person. if (this.persons.Count > 0) { this.SelectedPerson = this.Persons.Last(); } } else { // Get old one back from db this.selectedPerson.Model = Dal.GetPersonById(this.selectedPerson.Id); this.selectedPerson.IsInEditMode = false; } this.IsInEditMode = false; }
private void Delete_Executed() { // Remove from db Dal.DeletePerson(this.selectedPerson.Model); // Remove from list this.Persons.Remove(this.selectedPerson); this.SelectedPerson = null; }
private void New_Executed() { this.Persons.Add(new PersonViewModel(new Person())); this.SelectedPerson = this.persons.Last(); this.editCommand.Execute(null); }