public IActionResult ComplaintList(int?Page)
        {
            if (HttpContext.Session.GetString("UserRoleId") == "2")
            {
                var pageNumber = Page ?? 1;
                int pageSize   = 10;
                int sl         = 1;
                List <DeliveryVM> deliveryVMs = new List <DeliveryVM>();
                var orders = orderService.ComplaintListofTobeReturnedRefunded();
                if (orders != null)
                {
                    var pass = from a in orders
                               group a by new { a.Order.HiddenPKId } into b
                    orderby b.Key.HiddenPKId
                    let c = (from d in b
                             select new
                    {
                        orderId = d.OrderId,
                        hiddenPKId = b.Key.HiddenPKId,
                        customerId = d.Order.CustomerId,
                        customerName = d.Order.Customer.CustomerName,
                        area = d.Order.Customer.Area,
                        contact = d.Order.Customer.ContactNo,
                        shippingId = d.Order.ShippingId,
                        shipping = d.Order.Shipping.ShippingMethod,
                        payementId = d.Order.PaymentId,
                        payement = d.Order.Payment.PaymentMethod,
                        productId = d.Order.ProductInventoryId,
                        product = d.Order.ProductInventory.Name,
                        quantity = d.Order.Quantity,
                        totalPrice = d.Order.ProductInventory.SellPrice,
                        status = d.Status,
                        orderPlacedDate = d.Order.OrderDate,
                        orderDeliveredDate = d.DeliveredDate,
                    })
                            select c;
                    ProductInventory_VM       productInventory_VM = new ProductInventory_VM();
                    List <ProductInventoryVM> productInventoryVMs = new List <ProductInventoryVM>();
                    foreach (var item in pass)
                    {
                        var deliveryVM = new DeliveryVM();

                        foreach (var i in item)
                        {
                            ProductInventoryVM productInventoryVM = new ProductInventoryVM();
                            productInventoryVM.NameVM      = i.product;
                            productInventoryVM.QuantityVM  = i.quantity;
                            productInventoryVM.EachPriceVM = i.totalPrice * i.quantity;
                            deliveryVM.TotalPriceVM       += productInventoryVM.EachPriceVM;
                            productInventoryVM.StatusVM    = i.status;
                            deliveryVM.SerialNo            = sl;
                            deliveryVM.OrderVMId           = i.orderId;
                            deliveryVM.HiddenPKVMId        = i.hiddenPKId;
                            deliveryVM.CustomerVMId        = i.customerId;
                            deliveryVM.CustomerVMName      = i.customerName;
                            deliveryVM.CustomerVMArea      = i.area;
                            deliveryVM.CustomerVMContactNo = i.contact;
                            deliveryVM.ShippingVMId        = i.shippingId;
                            deliveryVM.ShippingVMMethod    = i.shipping;
                            deliveryVM.PaymentVMId         = i.payementId;
                            deliveryVM.PaymentVMMethod     = i.payement;
                            deliveryVM.ProductVMId         = i.productId;
                            if (deliveryService.DoneReturnedandRefunded(i.hiddenPKId) != null)
                            {
                                deliveryVM.StringReturnedRefundedVMStatus = "Done";
                            }
                            else if (deliveryService.PendingReturnedandRefunded(i.hiddenPKId) != null)
                            {
                                deliveryVM.StringReturnedRefundedVMStatus = "Pending";
                            }
                            deliveryVM.OrderPlacedVMDate = i.orderPlacedDate;
                            deliveryVM.DeliveredVMDate   = i.orderDeliveredDate;
                            if (deliveryService.GetReturnRefundListbyHiddenId(i.hiddenPKId).Count != 0)
                            {
                                if (deliveryService.TobeReturned(i.orderId) != null || deliveryService.Returned(i.orderId) != null)
                                {
                                    productInventoryVM.StringStatusVM = "Return";
                                }
                                else if (deliveryService.TobeRefunded(i.orderId) != null || deliveryService.Refunded(i.orderId) != null)
                                {
                                    productInventoryVM.StringStatusVM = "Refund";
                                }
                                else if (deliveryService.TobeReturnedandRefunded(i.orderId) != null || deliveryService.ReturnedandRefunded(i.orderId) != null)
                                {
                                    productInventoryVM.StringStatusVM = "Return & Refund";
                                }
                                //else
                                //{
                                //    productInventoryVM.StringStatusVM = "Delivered";
                                //}
                            }
                            deliveryVM.productInventory_VM.productInventoryVMs.Add(productInventoryVM);
                        }
                        deliveryVMs.Add(deliveryVM);
                        sl++;
                    }
                }
                return(View(deliveryVMs.ToPagedList(pageNumber, pageSize)));
            }
            return(RedirectToAction("Index", "Home"));
        }