Exemple #1
0
        private Auction SaveAuction(AuctionModel auctionModel)
        {
            Auction auction = new Auction()
            {
                AuctionGUID   = Guid.NewGuid(),
                BuyerReceived = false,
                EndDate       = auctionModel.EndDate,
                ItemName      = auctionModel.ItemName,
                SellerSent    = false,
                StartDate     = auctionModel.StartDate,
                StartingBid   = auctionModel.StartingBid,
                AuctionOver   = false
            };

            _auctionRepository.Add(auction);
            return(auction);
        }
Exemple #2
0
        public ActionResult Create(AuctionModel ModelObject)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    AuctionRepository repository = new AuctionRepository();
                    repository.Add(ModelObject);
                    return(RedirectToAction("GetAll"));
                }

                return(View());
            }
            catch
            {
                return(View());
            }
        }
        public void Test1()
        {
            var rep = new AuctionRepository();

            #region Save
            var auction = new Auction(1000, 10, DateTime.Now.AddDays(7), "Black shoes");
            auction.PlaceBid(new Bid()
            {
                Amount = 1100, BidderId = 12, OfferDateTime = DateTime.Now
            });
            auction.PlaceBid(new Bid()
            {
                Amount = 1200, BidderId = 23, OfferDateTime = DateTime.Now
            });

            rep.Add(auction);
            #endregion

            //var auction = rep.Get(Guid.Parse("62dd1efc-cace-4098-845c-1d87d013009a"));
        }