예제 #1
0
        public IActionResult Delete(int id)
        {
            Drink drink = _drinkRepository.Get(id);

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

            _drinkRepository.Remove(drink);
            if (_drinkRepository.Save() > 0)
            {
                return(NoContent());
            }

            ModelState.AddModelError("", "Something went wrong deleting the drink");
            return(StatusCode(500, ModelState));
        }