Esempio n. 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
            }));
        }
Esempio n. 2
0
 public async Task <List <string> > Handle(CitiesQuery request, CancellationToken cancellationToken)
 {
     return(await PersonPerCityCounterRepository.GetCities());
 }
Esempio n. 3
0
 public CitiesController(CitiesQuery citiesQueries, ILogger <CitiesController> logger)
 {
     _citiesQueries = citiesQueries;
     _logger        = logger;
 }
Esempio n. 4
0
 public CitiesController(CitiesQuery citiesQueries)
 {
     _citiesQueries = citiesQueries;
 }
Esempio n. 5
0
 public CitiesController(CitiesQuery citiesQuery)
 {
     _citiesQuery = citiesQuery;
 }