예제 #1
0
        public async Task <IActionResult> GetAllOrders()
        {
            var allOrders = await _order.GetAllOrderRecords();

            List <OrderDisplayModel> orders = new List <OrderDisplayModel>();

            foreach (var order in allOrders)
            {
                var table = await _table.GetTableById(order.DiningTableId);

                var server = await _people.GetPersonById(order.ServerId);

                orders.Add(new OrderDisplayModel
                {
                    Id          = order.Id,
                    TableNumber = table.TableNumber,
                    Server      = server.FullName,
                    SubTotal    = order.SubTotal,
                    Tax         = order.Tax,
                    Total       = order.Total,
                    CreatedDate = order.CreatedDate,
                    BillPaid    = order.BillPaid
                });
            }

            return(View(orders));
        }
예제 #2
0
        // Edit DiningTable with database Id = id
        public async Task <IActionResult> EditDiningTable(int id)
        {
            DiningTableModel foundTable = await _data.GetTableById(id);

            DiningTableDisplayModel table = new DiningTableDisplayModel
            {
                Id          = foundTable.Id,
                TableNumber = foundTable.TableNumber,
                Seats       = foundTable.Seats
            };

            return(View(table));
        }