예제 #1
0
        public IActionResult DeleteFood([FromRoute] int foodId)
        {
            var foodEntity = _foodInfoRepository.GetFood(foodId);

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

            _foodInfoRepository.DeleteFood(_foodInfoRepository.GetFood(foodId));

            if (!_foodInfoRepository.Save())
            {
                return(StatusCode(500, "Something went wrong saving to the database"));
            }

            return(NoContent());
        }