Beispiel #1
0
        public ActionResult GetMyVegetarianBurgers()
        {
            User          currentUserDb = userRepository.GetAll(x => x.Id == LoginUserSession.Current.UserId).FirstOrDefault();
            List <Burger> currentUserBurgersWithoutMeat        = currentUserDb.Burgers.Where(x => !(x.Ingredients.Any(c => c.IngredientType.Type == "Meats"))).ToList();
            List <GetABurgerViewModel> getABurgerViewModelList = new List <GetABurgerViewModel>();
            Waiter waiter = new Waiter();

            foreach (Burger burgerWithoutMeat in currentUserBurgersWithoutMeat)
            {
                IHamburgerViewModelBuilder hamburgerViewModelBuilder = new VegetarianBurgerViewModelBuilder(burgerWithoutMeat);
                waiter.SetHamburgerViewModelBuilder(hamburgerViewModelBuilder);
                waiter.ConstructHamburgerViewModel();
                getABurgerViewModelList.Add(waiter.GetABurgerViewModel());
            }
            return(View("GetMyBurgers", getABurgerViewModelList));
        }