Ejemplo n.º 1
0
        public async Task <IActionResult> Index(string keyword, DateTime fromDate, DateTime toDate, OrderStatus?status
                                                , int pageSize = 5, int pageIndex = 1)
        {
            if (toDate == DateTime.MinValue)
            {
                toDate = DateTime.Now;
            }
            var request = new OrderPagingRequest()
            {
                FromDate  = fromDate,
                Keyword   = keyword,
                ToDate    = toDate,
                PageIndex = pageIndex,
                PageSize  = pageSize,
                Status    = status
            };

            ViewBag.Statuss = Enum.GetValues(typeof(OrderStatus)).Cast <OrderStatus>()
                              .Select(x => new SelectListItem()
            {
                Text     = x.ToString(),
                Value    = ((int)x).ToString(),
                Selected = status.HasValue && status.ToString() == x.ToString()
            }).ToList();
            var orders = (await _orderApiClient.GetAllPaging(request)).ResultObj;

            ViewBag.FromDate = fromDate;
            ViewBag.ToDate   = toDate;
            ViewBag.keyword  = keyword;

            return(View(orders));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index(string keyword, int pageIndex = 1, int pageSize = 3)
        {
            var request = new GetOrderPagingRequest()
            {
                Keyword   = keyword,
                PageIndex = pageIndex,
                PageSize  = pageSize
            };
            var data = await _orderApiClient.GetAllPaging(request);

            ViewBag.Keyword = keyword;
            if (TempData["result"] != null)
            {
                ViewBag.SuccessMsg = TempData["result"];
            }
            return(View(data));
        }