Пример #1
0
        public ActionResult Index(string userEmail, int?orderID, int?orderStatus, int?pageNo)
        {
            var pageSize = ConfigurationsHelper.DashboardRecordsSizePerPage;

            OrdersListingViewModel model = new OrdersListingViewModel();

            model.PageTitle       = "Orders";
            model.PageDescription = "Orders Listing Page";

            model.UserEmail   = userEmail;
            model.OrderID     = orderID;
            model.OrderStatus = orderStatus;

            model.Orders = OrdersService.Instance.SearchOrders(model.UserEmail, model.OrderID, model.OrderStatus, pageNo, pageSize);
            var totalProducts = OrdersService.Instance.SearchOrdersCount(model.UserEmail, model.OrderID, model.OrderStatus);

            model.Pager = new Pager(totalProducts, pageNo, pageSize);

            if (Request.IsAjaxRequest())
            {
                return(PartialView(model));
            }
            else
            {
                return(View(model));
            }
        }
Пример #2
0
        public async Task <IActionResult> Index(int id = 1)
        {
            var orders = await this.orders.AllAsync(id);

            var ordersCount = await this.orders.CountAsync();

            var model = new OrdersListingViewModel
            {
                Orders      = orders,
                CurrentPage = id,
                OrdersCount = ordersCount,
                PagesCount  = (int)Math.Ceiling(ordersCount / (decimal)WebConstants.OrdersPerPage)
            };

            return(View(model));
        }
Пример #3
0
        public ActionResult Index(string userID, int?orderID, int?orderStatus, int?pageNo)
        {
            var recordSize = (int)RecordSizeEnums.Size10;

            OrdersListingViewModel model = new OrdersListingViewModel
            {
                UserID      = userID,
                OrderID     = orderID,
                OrderStatus = orderStatus
            };

            model.Orders = OrdersService.Instance.SearchOrders(model.UserID, model.OrderID, model.OrderStatus, pageNo, recordSize, count: out int ordersCount);

            model.Pager = new Pager(ordersCount, pageNo, recordSize);

            if (Request.IsAjaxRequest())
            {
                return(PartialView(model));
            }
            else
            {
                return(View(model));
            }
        }
Пример #4
0
        public async Task <IActionResult> Index(string customerId, string sort = null, int id = 1)
        {
            sort = sort ?? string.Empty;

            ViewData[WebConstants.ViewDataSortKey] = sort;

            var orders = await this.orders.AllAsync <OrderViewModel>(id, customerId, sort.ToLower());

            var ordersCount = await this.orders.CountByCustomerAsync(customerId);

            var customer = await this.customers.GetByIdAsync(customerId);

            var model = new OrdersListingViewModel
            {
                Orders       = orders,
                CurrentPage  = id,
                OrdersCount  = ordersCount,
                PagesCount   = (int)Math.Ceiling(ordersCount / (decimal)WebConstants.OrdersPerPage),
                CustomerName = $"{customer.FirstName} {customer.LastName}",
                CustomerId   = customerId
            };

            return(View(model));
        }