Example #1
0
        public IActionResult ConcreteDay(int date_ofset, int?StatusId, int productPage = 1)
        {
            var r_url = HttpContext.Request.PathAndQuery();

            if (HttpContext.Request.Method == "POST")
            {
                r_url += '?';
                if (!(StatusId is null))
                {
                    r_url += $"StatusId={StatusId}&";
                }
                r_url += $"date_ofset={date_ofset}&";
                r_url += $"productPage={productPage}";
            }
            ViewBag.r_url = r_url;

            ViewBag.ActionName = RouteData.Values["action"].ToString();
            var query = repository.GetConcreteDayBids(date_ofset).Where(b => StatusId == null || b.BidStatusId == StatusId);

            return(View("List", new BidsListViewModel
            {
                Bids = query.Skip((productPage - 1) * PageSize).Take(PageSize),
                PagingInfo = new PagingInfo
                {
                    CurrentPage = productPage,
                    ItemsPerPage = PageSize,
                    TotalItems = query.Count()
                },
                BidStatuses = statuses,
                FilterInfo = new FilterInfo
                {
                    DateOfset = date_ofset,
                    BidStatusId = StatusId
                }
            }));
        }