Esempio n. 1
0
        public async Task <int> AddThatFoods(string[] stringFoodIdList, int thatId)
        {
            MealFoods newMealFood = null;
            int       success     = 0;

            foreach (var thatFood in stringFoodIdList)
            {
                newMealFood             = new MealFoods();
                newMealFood.FKFoodId    = Convert.ToInt32(thatFood);
                newMealFood.FKThatDayId = thatId;

                await _mealFoodsRepository.Add(newMealFood);

                success = await _mealFoodsRepository.Save();
            }

            if (success > 0)
            {
                return(1);
            }
            return(0);
        }
Esempio n. 2
0
 public async Task <int> AddMealFoodsAsync(MealFoods mealFoods)
 {
     return(await _mealFoodsRepo.Add(mealFoods));
 }