private async void Delete_Executed() { // Remove from db await Dal.DeleteCars(new List <VintageMuscleCar>() { this.selectedCar.Model }); // Remove from list this.Cars.Remove(this.selectedCar); // Clear UI this.SelectedCar = null; }
private void Cancel_Executed() { if (this.selectedCar.Id == 0) { this.cars.Remove(this.selectedCar); this.SelectedCar = null; // Select last car. if (this.cars.Count > 0) { this.SelectedCar = this.Cars.Last(); } } else { // Get old one back from db this.selectedCar.Model = Dal.GetCarById(this.selectedCar.Id); this.selectedCar.IsInEditMode = false; } this.IsInEditMode = false; }
private void New_Executed() { this.Cars.Add(new VintageMuscleCarViewModel(new VintageMuscleCar())); this.SelectedCar = this.cars.Last(); this.editCommand.Execute(null); }
private async void Delete_Executed() { // Remove from db await Dal.DeleteCars(new List<VintageMuscleCar>() { this.selectedCar.Model }); // Remove from list this.Cars.Remove(this.selectedCar); // Clear UI this.SelectedCar = null; }