Exemple #1
0
        public async Task <int> AddNutritionListAsync(NutritionList nutritionList)
        {
            var savedNutritionList = await _nutritionListRepo.AddEntityAndGetId(nutritionList);

            NutritionDay nDay    = null;
            ThatDay      tDay    = null;
            int          success = 0;

            for (int i = 1; i <= 7; i++)
            {
                nDay      = new NutritionDay();
                nDay.Name = i + ".Gün";
                nDay.FKNutritionListId = savedNutritionList.Id;
                nDay = await _nutritionDayRepo.AddEntityAndGetId(nDay);

                for (int j = 1; j <= 5; j++)
                {
                    tDay                  = new ThatDay();
                    tDay.Name             = "That " + j;
                    tDay.FKNutritionDayId = nDay.Id;
                    if (j == 1)
                    {
                        tDay.EnumMealType = Domain.Enums.AllEnums.EnumMealType.Morning;
                    }
                    else if (j == 2)
                    {
                        tDay.EnumMealType = Domain.Enums.AllEnums.EnumMealType.Snacks1;
                    }
                    else if (j == 3)
                    {
                        tDay.EnumMealType = Domain.Enums.AllEnums.EnumMealType.Noon;
                    }
                    else if (j == 4)
                    {
                        tDay.EnumMealType = Domain.Enums.AllEnums.EnumMealType.Snacks2;
                    }
                    else if (j == 5)
                    {
                        tDay.EnumMealType = Domain.Enums.AllEnums.EnumMealType.Evening;
                    }
                    success = await _thatDayRepository.Add(tDay);
                }
            }
            if (success > 0)
            {
                return(1);
            }
            return(0);
        }
Exemple #2
0
 public async Task <int> AddThatDayAsync(ThatDay thatDay)
 {
     return(await _thatDayRepo.Add(thatDay));
 }