public void Call() { var vehicles = _vehicleRepository.GetAll(); PrintHelpers.PrintVehicles(vehicles); var isRead = ReadHelpers.TryReadNumber(out var vehicleId); if (!isRead) { return; } var result = _vehicleRepository.Delete(vehicleId); if (result == ResponseResultType.NotFound) { Console.WriteLine("Vehicle not found"); } if (result == ResponseResultType.Success) { Console.WriteLine("Vehicle successfully removed"); } if (result == ResponseResultType.NoChanges) { Console.WriteLine("No changes made"); } Console.ReadLine(); Console.Clear(); }
public void Call() { var vehicles = _vehicleRepository.GetAllWithExpiredRegistration(); PrintHelpers.PrintVehicles(vehicles); Console.ReadLine(); Console.Clear(); }
public void Call() { Console.WriteLine($"Enter start date {DateConstants.DateFormat}"); var startDate = DateTime.ParseExact(Console.ReadLine(), DateConstants.DateFormat, null); Console.WriteLine($"Enter end date {DateConstants.DateFormat}"); var endDate = DateTime.ParseExact(Console.ReadLine(), DateConstants.DateFormat, null); var vehicles = _vehicleRepository.GetAllAvailable(); PrintHelpers.PrintVehicles(vehicles); Console.WriteLine("Type in vehicle id"); var isVehicleIdRead = ReadHelpers.TryReadNumber(out var vehicleId); if (!isVehicleIdRead) { return; } var employees = _employeeRepository.GetAll(); PrintHelpers.PrintEmployees(employees); Console.WriteLine("Type in employee id"); var isEmployeeIdRead = ReadHelpers.TryReadNumber(out var employeeId); if (!isEmployeeIdRead) { return; } var customers = _customerRepository.GetAll(); PrintHelpers.ShortPrintCustomers(customers); Console.WriteLine("Type in customer id"); var isCustomerIdRead = ReadHelpers.TryReadNumber(out var customerId); if (!isCustomerIdRead) { return; } var rentRate = _rentRateRepository.GetNewestRentRates(); var result = _rentRepository.Add(startDate, endDate, vehicleId, rentRate.Id, employeeId, customerId); Console.WriteLine(result.Message); Console.ReadLine(); Console.Clear(); }
public void Call() { Console.WriteLine("Please write number of months to expire"); var isNumber = ReadHelpers.TryReadNumber(out var numberOfMonths); if (!isNumber) { return; } var vehicles = _vehicleRepository.GetAllExpiringByMonth(numberOfMonths); PrintHelpers.PrintVehicles(vehicles); Console.ReadLine(); Console.Clear(); }
public void Call() { var vehicles = _vehicleRepository.GetAllWithExpiredRegistration(); PrintHelpers.PrintVehicles(vehicles); Console.WriteLine("Type vehicle id to register"); var isRead = ReadHelpers.TryReadNumber(out var vehicleId); if (!isRead) { return; } Console.WriteLine("Enter vehicle registration date"); var registrationDate = DateTime.ParseExact(Console.ReadLine(), DateConstants.DateFormat, null); var result = _registrationRepository.Add(registrationDate, vehicleId); if (result == ResponseResultType.ValidationError) { Console.WriteLine("Registration date cannot be in future"); } if (result == ResponseResultType.NotFound) { Console.WriteLine("Vehicle not found"); } if (result == ResponseResultType.Success) { Console.WriteLine("Vehicle registration successfully saved"); } Console.ReadLine(); Console.Clear(); }