public async Task <IActionResult> AcceptTicket(string orderId)
        {
            var order = memory.ServiceRequests.Where(o => o.ReferenceNumber == orderId).FirstOrDefault();

            if (order != null && order.IsActive)
            {
                order.StatusID    = 3;
                order.OrderStatus = memory.GetStatus(3);
                bool update = await SendTicketResponse(order);

                if (update)
                {
                    bool res = await SendNotification("Service Request for Order Ref.no " + orderId + " Is Accepted by " + order.ServiceProviderDetails.ProviderName);
                }
                return(Ok(order));
            }

            return(Ok(new { Message = "Ticket is no longer available" }));
        }
        public async Task <IActionResult> UpdateServiceStatus(string orderId, int statusId)
        {
            OrderDTO orderDto = memory.ServiceRequests.Where(o => o.ReferenceNumber == orderId).FirstOrDefault();

            if (orderDto != null && orderDto.IsActive)
            {
                orderDto.StatusID    = statusId;
                orderDto.OrderStatus = memory.GetStatus(statusId);

                bool sendUpdate = await UpdateOrderStatus(orderDto);

                if (sendUpdate)
                {
                    bool res = await SendNotification("Status of Order Ref.No " + orderId + " Is updated to " + orderDto.OrderStatus);
                }
                return(Ok(new { message = "Status of Order Ref.No " + orderId + " Is updated to " + orderDto.OrderStatus }));
            }

            return(Ok(new { message = "Order Is Cancelled or not exist" }));
        }
示例#3
0
        public async Task <IActionResult> CancelOrder(string orderId)
        {
            OrderDTO order = memory.userData.MyOrders.Where(o => o.ReferenceNumber == orderId).FirstOrDefault();

            if (order != null && order.IsActive)
            {
                order.IsActive    = false;
                order.StatusID    = 5;
                order.OrderStatus = memory.GetStatus(5);
                bool send = await SendServiceRequest(order);

                if (send)
                {
                    bool res = await SendNotification("User Cancelled The service order Ref No." + orderId);
                }
                return(Ok(new { status = "Order Cancelled Successfully" }));
            }

            return(Ok(new { status = "Order Already Cancelled or not exist " }));
        }