public ActionResult Lots(LotsRequestModel lotsRequest)
        {
            if (lotsRequest.PageNumber == 0)
            {
                lotsRequest.PageNumber = 1;
            }

            var lots = _lotManagerService.GetLotsByTabName(lotsRequest.Tab, User.Identity.Name);

            var bllSearchModel = new BLLSearch
            {
                SearchByArtworkName   = lotsRequest.ArtworkName,
                SearchByPictureAuthor = lotsRequest.PictureAuthor,
                SearchByMinPrice      = lotsRequest.MinPrice,
                SearchByMaxPrice      = lotsRequest.MaxPrice,
                OrderByAuctionDate    = lotsRequest.OrderByAuctionDate
            };

            lots = _lotService.Search(bllSearchModel, lots).ToList();
            var model = _lotManagerService.BuildPagingModel(lots, lotsRequest, User.Identity.Name);

            return(PartialView("_AllLots", model));
        }
        public IEnumerable <BLLLot> Search(BLLSearch searchModel, List <BLLLot> lots)
        {
            var searchingListLots = lots;

            if (!string.IsNullOrEmpty(searchModel.SearchByPictureAuthor))
            {
                searchingListLots = lots
                                    .Where(l => l.Author.Contains(searchModel.SearchByPictureAuthor,
                                                                  StringComparison.OrdinalIgnoreCase)).ToList();
            }
            if (!string.IsNullOrEmpty(searchModel.SearchByArtworkName))
            {
                searchingListLots = searchingListLots.Where(l => l.ArtworkName.
                                                            Contains(searchModel.SearchByArtworkName,
                                                                     StringComparison.OrdinalIgnoreCase)).ToList();
            }

            if (searchModel.SearchByMinPrice > 0)
            {
                searchingListLots =
                    searchingListLots.Where(l => l.CurrentPrice >= searchModel.SearchByMinPrice).ToList();
            }

            if (searchModel.SearchByMaxPrice > 0 && searchModel.SearchByMaxPrice >= searchModel.SearchByMinPrice)
            {
                searchingListLots =
                    searchingListLots.Where(l => l.CurrentPrice <= searchModel.SearchByMaxPrice).ToList();
            }

            if (searchModel.OrderByAuctionDate)
            {
                searchingListLots = searchingListLots.OrderBy(l => l.DateOfAuction).ToList();
            }

            return(searchingListLots);
        }