public List <OrderViewModel> GetOrderBy(long accountId)
        {
            var accounts = _accountContext.Accounts.Select(x => new { x.Id, x.FullName }).ToList();

            var query = _shopContext.Orders
                        .Where(x => x.AccountId == accountId)
                        .Select(x => new OrderViewModel
            {
                Id              = x.Id,
                AccountId       = x.AccountId,
                DiscountAmount  = x.DiscountAmount,
                IsCanceled      = x.IsCanceled,
                IsPaid          = x.IsPaid,
                IssueTrackingNo = x.IssueTrackingNo,
                PayAmount       = x.PayAmount,
                RefId           = x.RefId,
                TotalAmount     = x.TotalAmount,
                PaymentMethod   = x.PaymentMethod,
                PaymentMethodId = x.PaymentMethod,
                CreationDate    = x.CreationDate.ToFarsi(),
            });

            var orders = query.OrderByDescending(x => x.Id);

            foreach (var order in orders)
            {
                order.AccountFullname   = accounts.FirstOrDefault(x => x.Id == order.AccountId)?.FullName;
                order.PaymentMethodText = PaymentMethod.GetBy(order.PaymentMethodId).Name;
            }

            return(orders.ToList());
        }
        public List <OrderViewModel> Search(OrderSearchModel searchModel)
        {
            var accounts = _accountContext.Accounts.Select(x => new { x.Id, x.Fullname }).ToList();
            var query    = _context.Orders.Select(x => new OrderViewModel
            {
                Id              = x.Id,
                AccountId       = x.AccountId,
                DiscountAmount  = x.DiscountAmount,
                IsCanceled      = x.IsCanceled,
                IsPaid          = x.IsPaid,
                IssueTrackingNo = x.IssueTrackingNo,
                PayAmount       = x.PayAmount,
                PaymentMethodId = x.PaymentMethod,
                RefId           = x.RefId,
                TotalAmount     = x.TotalAmount,
                CreationDate    = x.CreateionDate.ToFarsi()
            });

            query = query.Where(x => x.IsCanceled == searchModel.IsCanceled);

            if (searchModel.AccountId > 0)
            {
                query = query.Where(x => x.AccountId == searchModel.AccountId);
            }

            var orders = query.OrderByDescending(x => x.Id).ToList();

            foreach (var order in orders)
            {
                order.AccountFullName = accounts.FirstOrDefault(x => x.Id == order.AccountId)?.Fullname;
                order.PaymentMethod   = PaymentMethod.GetBy(order.PaymentMethodId).Name;
            }

            return(orders);
        }