コード例 #1
0
        public async Task <IActionResult> DeleteRestaurant(int id)
        {
            var restaurant = await _restaurantsRepository.GetAsync(id);

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

            _restaurantsRepository.Delete(restaurant);

            if (await _restaurantsRepository.SaveChangesAsync())
            {
                return(NoContent());
            }

            return(BadRequest());
        }
コード例 #2
0
        public void Delete(string id)
        {
            var restaurant = GetRestaurantById(id);

            restaurantsRepository.Delete(restaurant);
        }