示例#1
0
        internal void DeleteAuctionData(string email)
        {
            ABUser  user    = _abUserRepository.FindBy(x => x.Email == email).FirstOrDefault();
            Auction auction = user.Auction;

            if (auction != null)
            {
                if (auction.CurrentBid.Bidder.Email == email)
                {
                    auction.Auction_BidGUID = null;
                    var bidList = _bidRepository.FindBy(x => x.Bid_AuctionGUID == auction.AuctionGUID).ToList();
                    if (bidList != null && bidList.Count > 0)
                    {
                        foreach (var item in bidList)
                        {
                            _bidRepository.Delete(item);
                        }
                    }
                    _unitOfWork.Commit();
                    var userList = _abUserRepository.FindBy(x => x.ABUser_AuctionGUID == auction.AuctionGUID).ToList();
                    if (userList != null && userList.Count > 0)
                    {
                        foreach (var item in userList)
                        {
                            _abUserRepository.Delete(item);
                        }
                    }
                    _unitOfWork.Commit();
                    _auctionRepository.Delete(auction);
                    _unitOfWork.Commit();
                }
            }
        }