Esempio n. 1
0
        public async Task PopulateNewAuction(Auction auction)
        {
            if (auction.MinimumBid < 1)
            {
                auction.MinimumBid = 1;
            }

            if (auction.Increment < 1)
            {
                auction.Increment = 1;
            }

            Listing listing = listingRepository.GetListingByID(auction.ListingID);

            if (listing == null && auction.Listing == null)
            {
                auction.ListingID = 0;
            }
            else if (listing != null && auction.Listing == null)
            {
                auction.AddListing(listing);
            }

            if (auction.Copies < 1)
            {
                auction.Copies = 1;
            }

            if (auction.EndTime.CompareTo(DateTime.Now.AddMinutes(30)) <= 0)
            {
                auction.EndTime = DateTime.Now.AddMinutes(30);
            }

            auction.AddCreator(await GetCurrentUser());
        }