Exemplo n.º 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());
        }
Exemplo n.º 2
0
        public async Task <List <AuctionItem> > GetAllAuctions()
        {
            var auctions = await auctionsRepository.GetAllAuctions();

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

            return(auctionitems);
        }