public GrandPrixDriverDto MapDriver(ICarsRepository carsRepository, IDriversRepository driversRepository) { DriverDto driver = driversRepository.Get(driverId).Result.Map(); return(new GrandPrixDriverDto { team = team, carNumber = carNumber, driver = driver.firstName + " " + driver.lastName, car = carsRepository.Get(carId).Result.name, engine = engine, tyre = tyre, grid = grid, position = position, comment = comment }); }
public async Task <DriverDto> GetDriver(int id) { try { _logger.LogInformation(LoggingEvents.GetItem, "Get Driver by Id", id); var driver = await _driversRepository.Get(id); if (driver == null) { _logger.LogInformation(LoggingEvents.GetItem, $"Could not find Driver with id: { id }", id); return(null); } return(driver.Map()); } catch (Exception ex) { _logger.LogError(LoggingEvents.GetItem, ex, ex.Message, id); throw; } }