Beispiel #1
0
        public async Task <IActionResult> AddCityToCountry(int?countryId, int?cityId)
        {
            if (!countryId.HasValue || !cityId.HasValue)
            {
                return(BadRequest("Id must be given"));
            }

            var added = await _countryRepository.AddCityToCountry(cityId.Value, countryId.Value);

            if (added)
            {
                return(Ok("Added city to country"));
            }

            return(BadRequest("Country or city doesn't exist"));
        }