예제 #1
0
        public IActionResult DeleteRecipe(int id)
        {
            var recipe = RecipeManager.Get(id);

            if (recipe == null)
            {
                return(NotFound("404: Not found."));
            }
            if (recipe.CreatorId != User.Claims.FirstOrDefault(c => c.Type == "UserId").Value)
            {
                return(Unauthorized());
            }

            RecipeManager.Delete(id);
            return(NoContent());
        }