コード例 #1
0
        public ActionResult GetById(int id)
        {
            var city = citiesRepository.GetById(id);

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

            return(Ok(city.AsDto()));
        }
コード例 #2
0
        public ActionResult GetById(int cityId)
        {
            City city = _citiesRepository.GetById(cityId);

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

            return(Ok(city));
        }
コード例 #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)));
        }