public async Task <ActionResult> Find(string query, int?page, int?catId)
        {
            int pageSize = 15;

            page = page ?? 1;
            SearchResult <LotModel> searchResult;

            if (string.IsNullOrEmpty(query))
            {
                IEnumerable <LotModel> emptyQueryResults;
                if (catId.HasValue)
                {
                    int cat = catId.Value;
                    ViewData["CatId"] = catId;
                    emptyQueryResults = (await auctionService.GetRange(0, pageSize, t => t.Categorie == cat)).Select(t => t.ToLotMvc());
                }
                else
                {
                    emptyQueryResults = (await auctionService.GetRange(0, pageSize)).Select(t => t.ToLotMvc());
                }
                if (emptyQueryResults.Count() != 0)
                {
                    searchResult = new SearchResult <LotModel>(emptyQueryResults, auctionService.Count(), 1);
                    return(View(searchResult));
                }
                else
                {
                    ViewData["NoResults"] = "No results for your query.";
                    return(View());
                }
            }

            DateTime now     = DateTime.Now;
            var      results = (await auctionService.GetRange((page.Value - 1) * pageSize, pageSize, t => t.Title.Contains(query) || t.Description.Contains(query) && t.AuctionEndDate >= now)).Select(t => t.ToLotMvc());

            if (results.Count() <= 0)
            {
                ViewData["NoResults"] = "No results for your query.";
                return(View());
            }
            searchResult = new SearchResult <LotModel>(results, auctionService.Count(t => t.Title.Contains(query) || t.Description.Contains(query)), page.Value);
            return(View(searchResult));
        }
        public async Task <ActionResult> My(int?page)
        {
            int pageSize = 20;

            page = page ?? 1;
            int userId = await userService.GetId(User.Identity.Name);

            var results = (await auctionService.GetRange((page.Value - 1) * pageSize, pageSize, t => t.Seller == userId)).Select(t => t.ToLotMvc());

            if (results == null)
            {
                ViewData["NoResults"] = "No auctions";
            }

            var searchResult = new SearchResult <LotModel>(results, auctionService.Count(t => t.Seller == userId) / pageSize, page.Value);

            return(View(searchResult));
        }