示例#1
0
        public async Task <IEnumerable <RaiseDto> > GetRaisesForAuction(int auctionId)
        {
            using (UnitOfWorkProvider.Create())
            {
                var raises = await raiseService.GetRaisesByAuctionIDAsync(auctionId);

                return(raises.Items);
            }
        }
示例#2
0
        public async Task <IEnumerable <RaiseDto> > GetRaisesForAuction(AuctionDto auction)
        {
            if (auction == null)
            {
                return(new List <RaiseDto>());
            }

            var raises = await raiseService.GetRaisesByAuctionIDAsync(auction.Id);

            return(raises.Items);
        }
示例#3
0
        public async Task <bool> DeleteAuctionAsync(int auctionID)
        {
            if (auctionID == 0)
            {
                return(false);
            }
            using (var uow = UnitOfWorkProvider.Create())
            {
                if (await auctionService.GetAsync(auctionID) == null)
                {
                    return(false);
                }

                var items = (await itemService.GetItemsByAuctionIDAsync(auctionID));
                foreach (var item in items)
                {
                    var itemCategories = (await itemCategoryService.GetCategoryByItemIdsAsync(item.Id));
                    foreach (var itemCategory in itemCategories)
                    {
                        itemCategoryService.Delete(itemCategory.Id);
                    }

                    itemService.Delete(item.Id);
                }

                var raises = (await raiseService.GetRaisesByAuctionIDAsync(auctionID)).Items;
                foreach (var raise in raises)
                {
                    raiseService.Delete(raise.Id);
                }

                auctionService.Delete(auctionID);
                await uow.Commit();

                return(true);
            }
        }