Exemplo n.º 1
0
        public IActionResult Delete(int id)
        {
            Recipe        recipeToDelete = recipeDAL.GetRecipeByID(id);
            IActionResult output         = Unauthorized();

            if (authProvider.IsLoggedIn)
            {
                if (recipeToDelete.UserWhoAdded.Id == authProvider.GetCurrentUser().Id)
                {
                    recipeDAL.Delete(id);
                    return(Ok());
                }
            }

            return(output);
        }