public OrderVM(Order order, IOrderRepo orderRepo, IPizzaRepo pizzaRepo) { Order = order; SelectedPizzas = orderRepo.GetPizzasAsync(order.OrderId).Result; Pizzasorder = new MultiSelectList(pizzaRepo.GetPizzasAsync().Result, "PizzaId", "Name", SelectedPizzas); foreach (var pizza in pizzaRepo.GetPizzasAsync().Result) { Dictionary <Pizza, List <Size> > PizzaSizes = new Dictionary <Pizza, List <Size> >(); PizzaSizes.Add(pizza, pizzaRepo.GetPizzaSizes(pizza.Name).Result); } }
public PizzaOrdersVM(IOrderRepo orderRepo, IPizzaRepo pizzaRepo, Order order) { Order = order; SelectedPizzas = orderRepo.GetPizzasAsync(order.OrderId).Result; //Voor de pizza's in een order SelectedOrderPizzas = orderRepo.GetOrderPizzasAsync(order.OrderId).Result; //Voor de prijs uit de tussentabel te halen SelectedOrderSizes = orderRepo.GetOrderSizes(order.OrderId).Result; //Om de grootte van de pizza op te halen Pizzas = new MultiSelectList(pizzaRepo.GetPizzasAsync().Result, "PizzaId", "Name", SelectedPizzas); PizzaSizes = new Dictionary <string, SelectList>(); foreach (var pizza in pizzaRepo.GetPizzasAsync().Result) { PizzaSizes.Add(pizza.Name, new SelectList(pizzaRepo.GetPizzaSizes(pizza.Name).Result, "SizeId", "Name", SelectedPizzaSizes)); } }
public async Task <ActionResult <IEnumerable <PizzaDTO> > > GetPizzasAsync() { //return await _pizzaRepo.GetPizzasAsync(); //_logger.LogInformation("api/pizza - USED"); var pizza = await _pizzaRepo.GetPizzasAsync(); List <PizzaDTO> pizzadto = new List <PizzaDTO>(); pizza.ForEach(p => pizzadto.Add(_mapper.Map <PizzaDTO>(p))); return(pizzadto); }
// GET: Pizza public async Task <IActionResult> Index() { var pizzas = await _pizzaRepo.GetPizzasAsync(); return(View(pizzas)); }