public void LogOut(Employee employee) { var employeeDto = DTOUtils.GetEmployeeDto(employee); SendRequest(new LogOutRequest(employeeDto)); var response = ReadResponse(); if (response is ErrorResponse) { throw new Exception("Error Log Out"); } }
public bool LogIn(Employee employee, ITransportObserver client) { InitializeConnection(); var udto = DTOUtils.GetEmployeeDto(employee); SendRequest(new LoginRequest(udto)); var response = ReadResponse(); if (response is OkResponse) { _client = client; return(true); } CloseConnection(); return(false); }
public List <Ride> AddBooking(Ride ride, Booking booking, Employee employee, Client client) { var clientDto = DTOUtils.GetClientDto(client); var bookingDto = DTOUtils.GetBookingDto(booking); var rideDto = DTOUtils.GetRideDto(ride); var employeeDto = DTOUtils.GetEmployeeDto(employee); SendRequest(new BookingRequest(bookingDto, rideDto, employeeDto, clientDto)); var response = ReadResponse(); if (response is ErrorResponse) { throw new Exception("Error add reservation"); } return(((GetRidesResponse)response).Rides.Select(DTOUtils.GetFromDto).ToList()); }