示例#1
0
        public bool Update(HUTModels.Food model)
        {
            try
            {
                Food food = new Food()
                {
                    CaloriesPer100Grams = model.CaloriesPer100Grams, Description = model.Description, FoodId = model.FoodId
                };

                // checking separately so we don't accidentally delete the URL while doing some testing
                if (model.PhotoURL != null)
                {
                    food.PhotoURL = model.PhotoURL;
                }

                repo.Update(food);
                repo.Save();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#2
0
        public bool Update(HUTModels.Recipe model)
        {
            try
            {
                repo.Update(model);
                repo.Save();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#3
0
        public bool Update(HUTModels.FreezerInventory model)
        {
            try
            {
                FreezerInventory inventory = new FreezerInventory()
                {
                    FreezerInventoryId = model.FreezerInventoryId, ItemName = model.ItemName, Quantity = model.Quantity
                };

                repo.Update(inventory);
                repo.Save();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#4
0
        public bool Update(HUTModels.Ingredient model)
        {
            try
            {
                Ingredient ingredient = new Ingredient()
                {
                    FoodId = model.FoodId, RecipeId = model.RecipeId, Weight = model.Weight, IngredientId = model.IngredientId
                };

                repo.Update(ingredient);
                repo.Save();

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