public void Call() { var employees = _employeeRepository.GetAll(); PrintHelpers.PrintEmployees(employees); Console.WriteLine("Type in Employee Id or exit"); var isRead = ReadHelpers.TryReadNumber(out var employeeId); if (!isRead) { return; } var result = _employeeRepository.Delete(employeeId); if (result == ResponseResultType.NotFound) { Console.WriteLine("Employee not found"); } if (result == ResponseResultType.Success) { Console.WriteLine("Employee successfully added"); } if (result == ResponseResultType.NoChanges) { Console.WriteLine("No changes have been applied"); } Console.ReadLine(); Console.Clear(); }
public void Call() { var employees = _employeeRepository.GetAll(); PrintHelpers.PrintEmployees(employees); Console.WriteLine("Enter employee id or exit"); var isRead = ReadHelpers.TryReadNumber(out var employeeId); if (!isRead) { return; } Console.WriteLine("Number of last rents"); isRead = ReadHelpers.TryReadNumber(out var numberOfMonths); if (!isRead) { return; } var rents = _rentRepository.GetByEmployee(numberOfMonths, employeeId); PrintHelpers.PrintRents(rents); 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() { var employees = _employeeRepository.GetAll(); PrintHelpers.PrintEmployees(employees); var isRead = ReadHelpers.TryReadNumber(out var employeeId); if (!isRead) { return; } var employee = employees.First(e => e.Id == employeeId); Console.WriteLine("Press enter to skip edit"); Console.WriteLine($"First Name: ({employee.FirstName})"); employee.FirstName = ReadHelpers.TryReadLineIfNotEmpty(out var firstName) ? firstName : employee.FirstName; Console.WriteLine($"Last name: ({employee.LastName})"); employee.LastName = ReadHelpers.TryReadLineIfNotEmpty(out var lastName) ? lastName : employee.LastName; var result = _employeeRepository.Edit(employee, employeeId); if (result == ResponseResultType.NotFound) { Console.WriteLine("Employee not found"); } if (result == ResponseResultType.Success) { PrintHelpers.PrintEmployee(employee); } if (result == ResponseResultType.NoChanges) { Console.WriteLine("No changes applied"); } Console.ReadLine(); Console.Clear(); }