예제 #1
0
        public async Task <IList <Auction> > GetClosedAuctions(int groupCode, DateTime startDate, DateTime endDate, ClaimsPrincipal userClaimsPrincipal, bool ownAuctions = false)
        {
            var user = await _userManager.GetUserAsync(userClaimsPrincipal);

            var auctions = (await _repository.GetAllAuctions(groupCode))
                           .Where((a) =>
            {
                var result = false;

                if (!isOpen(a) && a.SlutDatum >= startDate && a.SlutDatum <= endDate)
                {
                    result = true;
                }

                if (ownAuctions)
                {
                    if (a.SkapadAv != user.UserName)
                    {
                        result = false;
                    }
                }

                return(result);
            });

            return(auctions.ToList());
        }
예제 #2
0
        public async Task <List <AuctionItem> > GetAllAuctions()
        {
            var auctions = await auctionsRepository.GetAllAuctions();

            var auctionitems = auctions.Select(ConvertAuctionToAuctionItem).ToList();

            return(auctionitems);
        }