Esempio n. 1
0
        private static async Task CompleteSesshinDay(Sesshin newYearSesshin, ProductContext productContext)
        {
            DayOfSesshin sesshinDay = newYearSesshin.Days.FirstOrDefault(d => d.Date == new DateTime(2019, 12, 30));
            Meal         lunch      = CompleteSesshinDayLunch(sesshinDay, productContext);
            Meal         diner      = CompleteSesshinDayDiner(sesshinDay, productContext);

            await productContext.SaveChangesAsync();
        }
Esempio n. 2
0
        private static async Task CompleteSecondPreparationDay(Sesshin newYearSesshin, ProductContext productContext)
        {
            DayOfSesshin secondDayPreparation = newYearSesshin.Days.FirstOrDefault(d => d.Date == new DateTime(2019, 12, 29));
            Meal         lunch = CompleteSecondDayPreparationLunch(secondDayPreparation, productContext);
            Meal         diner = CompleteSecondDayPreparationDiner(secondDayPreparation, productContext);

            await productContext.SaveChangesAsync();
        }
Esempio n. 3
0
        private static async Task CompleteLastDay(Sesshin newYearSesshin, ProductContext productContext)
        {
            //First Meal: Split pea soup + potatoes
            DayOfSesshin lastDay   = newYearSesshin.Days.FirstOrDefault(d => d.Date == new DateTime(2020, 01, 01));
            Meal         breakfast = CompleteLastDayBreakfast(lastDay, productContext);
            Meal         lunch     = CompleteLastDayLunch(lastDay, productContext);

            await productContext.SaveChangesAsync();
        }
Esempio n. 4
0
        private static async Task CompleteFirstPreparationDay(Sesshin newYearSesshin, ProductContext productContext)
        {
            //First Meal: Split pea soup + potatoes
            DayOfSesshin firstDayPreparation = newYearSesshin.Days.FirstOrDefault(d => d.Date == new DateTime(2019, 12, 28));
            Meal         breakfast           = CompleteFirstDayPreparationBreakfast(firstDayPreparation, productContext);
            Meal         lunch = CompleteFirstDayPreparationLunch(firstDayPreparation, productContext);
            Meal         diner = CompleteFirstDayPreparationDiner(firstDayPreparation, productContext);

            await productContext.SaveChangesAsync();
        }
Esempio n. 5
0
        private static Meal CompleteSesshinDayLunch(DayOfSesshin sesshinDay, ProductContext productContext)
        {
            Meal lunch = sesshinDay.Meals.FirstOrDefault(m => m.Type == MealType.Lunch);

            lunch.MealFoods = new List <MealFood>();
            lunch.MealFoods.Add(new MealFood {
                Meal = lunch, Food = CauliFlowerGratin(productContext)
            });
            AddSimpleFoodToMeal("Pear", 90M, UnityType.Unity, lunch, productContext);

            return(lunch);
        }
Esempio n. 6
0
        private static Meal CompleteFirstDayPreparationDiner(DayOfSesshin firstDayPreparation, ProductContext productContext)
        {
            Meal diner = firstDayPreparation.Meals.FirstOrDefault(m => m.Type == MealType.Diner);

            diner.MealFoods = new List <MealFood>();
            diner.MealFoods.Add(new MealFood {
                Meal = diner, Food = Tortillas(productContext)
            });
            AddSimpleFoodToMeal("Chocolate soya dessert", 90M, UnityType.Unity, diner, productContext);

            return(diner);
        }
Esempio n. 7
0
        private static Meal CompleteSecondDayPreparationLunch(DayOfSesshin secondDayPreparation, ProductContext productContext)
        {
            Meal lunch = secondDayPreparation.Meals.FirstOrDefault(m => m.Type == MealType.Lunch);

            lunch.MealFoods = new List <MealFood>();
            lunch.MealFoods.Add(new MealFood {
                Meal = lunch, Food = SpaghettiWithBrocoliSauce(productContext)
            });
            AddSimpleFoodToMeal("Kiwifruit", 90M, UnityType.Unity, lunch, productContext);

            return(lunch);
        }
Esempio n. 8
0
        private static Meal CompleteFirstDayPreparationLunch(DayOfSesshin firstDayPreparation, ProductContext productContext)
        {
            Meal lunch = firstDayPreparation.Meals.FirstOrDefault(m => m.Type == MealType.Lunch);

            lunch.MealFoods = new List <MealFood>();
            lunch.MealFoods.Add(new MealFood {
                Meal = lunch, Food = Ratatouille(productContext)
            });
            AddSimpleFoodToMeal("Rice", 3.6M, UnityType.Kilogrammes, lunch, productContext);
            AddSimpleFoodToMeal("Apple", 90M, UnityType.Unity, lunch, productContext);

            return(lunch);
        }
Esempio n. 9
0
        private static Meal CompleteFirstDayPreparationBreakfast(DayOfSesshin firstDayPreparation, ProductContext productContext)
        {
            Meal breakfast = firstDayPreparation.Meals.FirstOrDefault(m => m.Type == MealType.Genmai);

            breakfast.Type      = MealType.Breakfast;
            breakfast.MealFoods = new List <MealFood>();
            AddSimpleFoodToMeal("Coffee", 3M, UnityType.Kilogrammes, breakfast, productContext);
            breakfast.MealFoods.Add(new MealFood {
                Meal = breakfast, Food = BreadButterAndJam(productContext)
            });

            return(breakfast);
        }
Esempio n. 10
0
        private static Meal CompleteSesshinDayDiner(DayOfSesshin sesshinDay, ProductContext productContext)
        {
            Meal diner = sesshinDay.Meals.FirstOrDefault(m => m.Type == MealType.Diner);

            diner.MealFoods = new List <MealFood>();
            diner.MealFoods.Add(new MealFood {
                Meal = diner, Food = SquashSoup(productContext)
            });
            diner.MealFoods.Add(new MealFood {
                Meal = diner, Food = productContext.Food.FirstOrDefault(f => f.Name == "Apple")
            });

            return(diner);
        }
Esempio n. 11
0
        private static Meal CompleteLastDayLunch(DayOfSesshin lastDay, ProductContext productContext)
        {
            Meal lunch = lastDay.Meals.FirstOrDefault(m => m.Type == MealType.Lunch);

            lunch.MealFoods = new List <MealFood>();
            lunch.MealFoods.Add(new MealFood {
                Meal = lunch, Food = VegetarianLasagna(productContext)
            });
            lunch.MealFoods.Add(new MealFood {
                Meal = lunch, Food = FruitSalad(productContext)
            });

            return(lunch);
        }
Esempio n. 12
0
        private static Meal CompleteRestDayLunch(DayOfSesshin restDay, ProductContext productContext)
        {
            Meal lunch = restDay.Meals.FirstOrDefault(m => m.Type == MealType.Lunch);

            lunch.MealFoods = new List <MealFood>();
            lunch.MealFoods.Add(new MealFood {
                Meal = lunch, Food = BasicPicNic(productContext)
            });
            lunch.MealFoods.Add(new MealFood {
                Meal = lunch, Food = productContext.Food.FirstOrDefault(f => f.Name == "Banana")
            });

            return(lunch);
        }
Esempio n. 13
0
        private static Meal CompleteSecondDayPreparationDiner(DayOfSesshin secondDayPreparation, ProductContext productContext)
        {
            Meal diner = secondDayPreparation.Meals.FirstOrDefault(m => m.Type == MealType.Diner);

            diner.MealFoods = new List <MealFood>();
            diner.MealFoods.Add(new MealFood {
                Meal = diner, Food = MixedVegetableCurry(productContext)
            });
            diner.MealFoods.Add(new MealFood {
                Meal = diner, Food = productContext.Food.FirstOrDefault(f => f.Name == "Rice")
            });
            AddSimpleFoodToMeal("Orange", 90M, UnityType.Unity, diner, productContext);

            return(diner);
        }
Esempio n. 14
0
        public async Task <MealFoodViewModel> GetMealFoodViewModel(int mealId, int sesshinId)
        {
            //We want the number of people of the day of the meal
            Meal meal = await GetByIdAsync(mealId);

            DayOfSesshin day = await _dayOfSesshinRepository.GetByIdAsync(meal.DayOfSesshinId);

            MealFoodViewModel vm = new MealFoodViewModel {
                MealId = mealId, SesshinId = sesshinId, Food = new Food {
                    NumberOfPeople = day.NumberOfPeople
                }
            };

            return(vm);
        }
Esempio n. 15
0
        private static Meal CompleteLastDayBreakfast(DayOfSesshin lastDay, ProductContext productContext)
        {
            Meal breakfast = lastDay.Meals.FirstOrDefault(m => m.Type == MealType.Genmai);

            breakfast.MealFoods = new List <MealFood>();
            breakfast.Type      = MealType.Breakfast;
            breakfast.MealFoods.Add(new MealFood {
                Food = productContext.Food.FirstOrDefault(f => f.Name == "Coffee"), Meal = breakfast
            });
            breakfast.MealFoods.Add(new MealFood {
                Food = productContext.Food.FirstOrDefault(f => f.Name == "Bread, butter and jelly"), Meal = breakfast
            });

            return(breakfast);
        }
Esempio n. 16
0
        private static Meal CompleteRestDayDiner(DayOfSesshin restDay, ProductContext productContext)
        {
            Meal diner = restDay.Meals.FirstOrDefault(m => m.Type == MealType.Diner);

            diner.MealFoods = new List <MealFood>();
            diner.MealFoods.Add(new MealFood {
                Meal = diner, Food = MafeSeitan(productContext)
            });
            diner.MealFoods.Add(new MealFood {
                Meal = diner, Food = productContext.Food.FirstOrDefault(f => f.Name == "Rice")
            });
            diner.MealFoods.Add(new MealFood {
                Meal = diner, Food = LimonPie(productContext)
            });

            return(diner);
        }
Esempio n. 17
0
        private static async Task CompleteComingDayDiner(Sesshin newYearSesshin, ProductContext productContext)
        {
            //First Meal: Split pea soup + potatoes
            DayOfSesshin comingDay      = newYearSesshin.Days.FirstOrDefault(d => d.Date == new DateTime(2019, 12, 27));
            Meal         comingDayDiner = comingDay.Meals.FirstOrDefault(m => m.Type == MealType.Diner);

            comingDayDiner.MealFoods = new List <MealFood>();

            comingDayDiner.MealFoods.Add(new MealFood {
                Meal = comingDayDiner, Food = SplitPeaSoup(productContext)
            });
            comingDayDiner.MealFoods.Add(new MealFood {
                Meal = comingDayDiner, Food = RoastedPotatoes(productContext)
            });
            AddSimpleFoodToMeal("Banana", 90M, UnityType.Unity, comingDayDiner, productContext);

            await productContext.SaveChangesAsync();
        }
Esempio n. 18
0
        private ICollection <DayOfSesshin> SetDaysOfTheSesshin(Sesshin sesshin)
        {
            List <DayOfSesshin> daysOfSesshins = new List <DayOfSesshin>();
            bool comingDay = true;

            for (DateTime loopDate = sesshin.StartDate.AddDays(-1); loopDate <= sesshin.EndDate; loopDate = loopDate.AddDays(1))
            {
                DayOfSesshin dayOfSesshin = new DayOfSesshin
                {
                    Date           = loopDate,
                    NumberOfPeople = sesshin.NumberOfPeople,
                    Meals          = SetDailyMeals(comingDay, loopDate == sesshin.EndDate),
                    Sesshin        = sesshin
                };
                daysOfSesshins.Add(dayOfSesshin);
                comingDay = false;
            }
            sesshin.Days = daysOfSesshins;

            return(daysOfSesshins);
        }
        private bool IsAuthorizedDayOperation(AuthorizationHandlerContext context, OperationAuthorizationRequirement requirement, DayOfSesshin dayOfSesshin)
        {
            //Get the sesshin tenzo
            if (requirement.Name == Constants.ReadOperationName)
            {
                return(true);
            }
            string sesshinOwner = _sesshinService.GetSesshinOwner(dayOfSesshin.SesshinId);

            return(sesshinOwner == _userManager.GetUserId(context.User));
        }