public async Task AddAsync(AddCityRequestCommand command) { try { var cityRequestEntity = new CityRequestEntity(command.CityName); if (!cityRequestEntity.IsValid()) { _logger.LogInformation(CityWeatherLogConstants.ADD_CITY_WEATHER_ERROR, cityRequestEntity.CityName); return; } await _cityRepository.AddAsync(cityRequestEntity); } catch (Exception error) { _logger.LogError(error, error.Message); } }
public async Task AddAsync(string cityName) { await _cityRepository.AddAsync(new CityRequestModel(cityName)); }