Пример #1
0
        public async Task <ActionResult <List <BidVM> > > GetPendingOrSuccessfulBidsOfCustomer(string customerId)
        {
            List <Bid> pendingOrSuccessfulBids = await bidService.GetPendingOrSuccessfulBidsOfCustomer(customerId);

            List <BidVM> bidVms = pendingOrSuccessfulBids.Select(bid => new BidVM(bid)).ToList();

            List <DiscountScheme> discountSchemes = await discountSchemeService.GetAllDiscountSchemesWithBid();

            foreach (BidVM bidVm in bidVms)
            {
                bidVm.CurrentTotalBids = GetTotalPendingBids(bidVm.DiscountSchemeId, discountSchemes);
            }

            bidVms.Reverse();

            return(Ok(bidVms));
        }