public ActionResult GetById(int id)
        {
            var city = citiesRepository.GetById(id);

            if (city is null)
            {
                return(NotFound());
            }

            return(Ok(city.AsDto()));
        }
        public ActionResult GetById(int cityId)
        {
            City city = _citiesRepository.GetById(cityId);

            if (city == null)
            {
                return(NotFound());
            }

            return(Ok(city));
        }
Beispiel #3
0
        public async Task <IActionResult> Delete(Guid id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var city = repository.GetById(id);

            if (city == null)
            {
                return(NotFound());
            }
            repository.Delete(city);
            return(RedirectToAction(nameof(Index)));
        }