Ejemplo n.º 1
0
        // GET: Offers
        public ActionResult Index()
        {
            int?page = null;
            int value;

            if (int.TryParse(Request.QueryString["page"], out value))
            {
                page = value;
            }
            var tOferta   = service.GetOffers();
            var filtering = new FilteringData(Request.QueryString, ModelState);

            tOferta = filtering.Apply(tOferta).OrderBy(i => i.DataWyjazdu);

            int pageNumber = (page ?? 1);
            IDictionary <int, bool> offerToReservedMap = service.GetOfferIdToReservedMap(AuthorizeUtil.GetUserId(service, User));

            return(View(new OffersViewModel(
                            tOferta.ToPagedList(pageNumber, filtering.ItemsOnPage), filtering, offerToReservedMap)));
        }