public CarListViewModel() { carDataService = new CarDataService(); dialogService = new DialogService(); LoadData(); //attaching command LoadCommand(); //register for list data changes/updates Messenger.Default.Register <UpdateListMessage>(this, OnUpdateListMessageReceived); }
private static void Main(string[] args) { _service = new CarDataService(); _resService = new ReservationDataService(); string input = ""; while (input.ToUpper() != "Q") { Console.WriteLine("L) List Cars"); Console.WriteLine("#) Show specific Car"); Console.WriteLine("N) Enter a new Car"); Console.WriteLine("Q) Quit"); Console.Write("Please enter a command: "); input = Console.ReadLine().ToUpper(); int index = 0; if (input == "L") { ListCars(); } else if (input == "N") { EnterCar(); } else if (int.TryParse(input, out index)) { ShowCar(index); } } input = ""; while (input.ToUpper() != "Q") { Console.WriteLine("L) List Reservations"); Console.WriteLine("#) Show specific Reservation"); Console.WriteLine("N) Enter a new Reservation"); Console.WriteLine("Q) Quit"); Console.Write("Please enter a command: "); input = Console.ReadLine().ToUpper(); if (input == "L") { ListReservations(); } else if (input == "N") { EnterReservation(); } else { int carId = int.Parse(Console.ReadLine()); int costumerId = int.Parse(Console.ReadLine()); ShowReservation(carId, costumerId); } } }
/// <summary> /// Executes when SaveCarCommand is called /// </summary> public void SaveCarExecute() { if (Car.EntityState == EntityState.Detached) { CarDataService.Save(Car, OnCarSaved, null); } else { CarDataService.Save(OnCarSaved, null); } }
private ICarDataService GetCarDataService() { ICarDataService service = new CarDataService(TestBase.MockCarDataProvider(JSON)); return(service); }
/// <summary> /// MainViewModel method to get a list of cars from a sample data service /// </summary> private async void LoadCarsFromService() { Cars = await CarDataService.GetSampleCarsAsync(); }
public CarDetailViewModel() { Messenger.Default.Register <Car>(this, OnCarReceived); DeleteCommand = new CustomCommand(DeleteCar, canDeleteCar); carDataService = new CarDataService(); }
private void LoadCar(int carId) { Car = null; CarDataService.GetCarById(carId, GetCarByIdCallback); }