public async void GetOngoingOrders() { // Gets order status 0 and checks if an order has a pizza in it otherwise change // Order Status to two. DataBaseList = await rep.GetOrderByStatus(0); foreach (Order order in DataBaseList) { if (order.PizzaList.Count < 1) { await rep.UpdateOrderStatusWhenOrderIsCooked(order); } } DataBaseList = await rep.GetOrderByStatus(0); OrdersOngoing.Clear(); foreach (Order item in DataBaseList) { OrderModel order = new OrderModel(); order.OrderID = item.OrderID; OrdersOngoing.Add(order); } }
public async void GetOngoingOrders() { DatabaseList = await rep.GetOrderByStatus(0); OrdersOngoing.Clear(); WaitingOrders.Clear(); int test = 0; foreach (Order item in DatabaseList) { OrderModel order = new OrderModel(); OrderModel waitingOrder = new OrderModel(); if (item.PizzaList.Count > 0 && test < 6) { order = new OrderModel(); order.OrderID = item.OrderID; order.PizzaList = item.PizzaList; OrdersOngoing.Add(order); test++; } else if (item.PizzaList.Count > 0) { waitingOrder.OrderID = item.OrderID; WaitingOrders.Add(waitingOrder); test++; } } }