コード例 #1
0
ファイル: RecipeBLL.cs プロジェクト: marksman315/HUTWebAPI
        public bool Delete(int recipeId)
        {
            try
            {
                // delete all the child ingredients first by getting them and looping to delete them all (not very efficient)
                // there needs to be a better way to do this en masse
                HUTModels.Recipe recipe = GetRecipeWithIngredients(recipeId);

                IngredientBLL bll = new IngredientBLL(this.repo);

                foreach (HUTModels.Ingredient ingredient in recipe.Ingredients)
                {
                    bll.Delete(ingredient.IngredientId);
                }

                repo.Delete <Recipe>(recipeId);
                repo.Save();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #2
0
        public bool Delete(int freezerInventoryId)
        {
            try
            {
                repo.Delete <FreezerInventory>(freezerInventoryId);
                repo.Save();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #3
0
        public bool Delete(int ingredientId)
        {
            try
            {
                repo.Delete <Ingredient>(ingredientId);
                repo.Save();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }