Example #1
0
        public async Task <IActionResult> SaveOrderByTable(int tableNumber)
        {
            if (await _table.IsValidTableNumber(tableNumber) == false)
            {
                return(RedirectToAction("TableNotExistError", "Home"));
            }

            // Get order summary for all the dining tables
            var orderList = await _order.GetAllOrders();

            var table = await _table.GetTableByTableNumber(tableNumber);

            foreach (var order in orderList)
            {
                // This dining table is being used and current bill not paid
                // Will delete its current order summary and insert updated one
                if (order.DiningTableId == table.Id && order.BillPaid == false)
                {
                    await _order.DeleteOrder(order.Id);
                }
            }

            // Insert updated order summary of this dining table into database
            await _order.InsertOrderByTable(table.Id);

            return(RedirectToAction("Index", "Home"));
        }
        public async Task <IActionResult> OnPost()
        {
            //delete record
            await _orderData.DeleteOrder(Id);

            return(RedirectToPage("./List"));
        }
Example #3
0
        public async Task <IActionResult> Delete(OrderModel order)
        {
            await _orderData.DeleteOrder(order.Id);

            return(RedirectToAction("Create"));
        }
        public async Task <IActionResult> Delete(int id)
        {
            await _orderData.DeleteOrder(id);

            return(Ok());
        }
Example #5
0
        public async Task <IActionResult> OnPost()
        {
            await _orderData.DeleteOrder(Id);

            return(RedirectToPage("./create"));
        }
        public async Task <IActionResult> DeleteById(int id)
        {
            await _orderData.DeleteOrder(id);

            return(RedirectToAction("Create"));
        }