Esempio n. 1
0
        public AuctionListResponseModel GetActiveAuctions(AuctionListRequestModel request)
        {
            ValidateAuctionList(request);

            // note: kke: if the user is not logged in, cant use search functionality!
            if (m_permissionService.GetUserId().IsNotSpecified())
            {
                request.SearchValue = null;
            }

            (int startFrom, int endAt) = Pagination.GetOffsetAndSize(request);

            // Note: kke: load only active auctions.
            DateTime fromDate = DateTime.UtcNow;

            AuctionListResponseModel auctionsResponse = new AuctionListResponseModel()
            {
                Auctions  = m_auctionsRepository.GetActiveAuctions(request, startFrom, endAt, fromDate).ToList(),
                ItemCount = m_auctionsRepository.ActiveAuctionCount().Count()
            };

            Pagination.PaginateResponse(ref auctionsResponse, TableItem.DefaultSize, request.CurrentPage);

            return(auctionsResponse);
        }
Esempio n. 2
0
        public AuctionListResponseModel GetAllAuctions(AuctionListRequestModel request)
        {
            ValidateAuctionList(request);

            // TODO: kke: validate request.SearchValue to be valid value!

            (int startFrom, int endAt) = Pagination.GetOffsetAndSize(request);

            // Note: kke: load all possible auctions.
            DateTime fromDate = new DateTime(1900, 1, 1);

            AuctionListResponseModel auctionsResponse = new AuctionListResponseModel()
            {
                Auctions  = m_auctionsRepository.GetActiveAuctions(request, startFrom, endAt, fromDate).ToList(),
                ItemCount = m_auctionsRepository.AllAuctionCount().Count()
            };

            Pagination.PaginateResponse(ref auctionsResponse, TableItem.DefaultSize, request.CurrentPage);

            return(auctionsResponse);
        }