Exemplo n.º 1
0
            public bool Remove(MealComponent component)
            {
                var result = _items.Remove(component);

                if (result)
                {
                    NutritionInfo -= component;
                }

                return(result);
            }
Exemplo n.º 2
0
        public async Task SaveMenuAsync(NutritionInfo meal)
        {
            if (meal != null)
            {
                foreach (var food in meal.item)
                {
                    if (meal.id > 0)
                    {
                        SavedMenu menuItem = new SavedMenu()
                        {
                            ItemId  = food.ItemID,
                            MealId  = meal.id,
                            Serving = food.Serving
                        };

                        _dbContext.SavedMenu.Add(menuItem);
                        await _dbContext.SaveChangesAsync();
                    }
                }
            }
        }
Exemplo n.º 3
0
 public void Add(MealComponent component)
 {
     _items.Add(component);
     NutritionInfo += component;
 }