Пример #1
0
        public async Task <ActionResult> GetAllCities([FromQuery] CitiesQuery query)
        {
            if (query.countryName == null)
            {
                ModelState.AddModelError("countryName", "Отсутствует значение параметра");
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ResponseError
                {
                    error = true,
                    message = GetModelStateError()
                }));
            }
            var cities = await _timeZoneCorrector.GetCities(query.countryName, query.stateName, query.districtName);

            if (cities == null)
            {
                return(BadRequest(new ResponseError
                {
                    error = true,
                    message = "Cities not found"
                }));
            }
            return(Ok(new ResponseResult <List <string> >()
            {
                error = false,
                result = cities
            }));
        }
Пример #2
0
 public async Task <List <string> > Handle(CitiesQuery request, CancellationToken cancellationToken)
 {
     return(await PersonPerCityCounterRepository.GetCities());
 }
Пример #3
0
 public CitiesController(CitiesQuery citiesQueries, ILogger <CitiesController> logger)
 {
     _citiesQueries = citiesQueries;
     _logger        = logger;
 }
Пример #4
0
 public CitiesController(CitiesQuery citiesQueries)
 {
     _citiesQueries = citiesQueries;
 }
Пример #5
0
 public CitiesController(CitiesQuery citiesQuery)
 {
     _citiesQuery = citiesQuery;
 }