Beispiel #1
0
        public void AddBidToItem(Bid bid, AuctionItem auctionItem)
        {
            if (bid.BidAmount > auctionItem.MinimumBid) {
                auctionItem.MinimumBid = bid.BidAmount;
                auctionItem.CurrentBids++;

                _db.SaveChanges();
            }
        }
Beispiel #2
0
        public void PlaceBid(Bid bid, AuctionItem auctionItem)
        {
            if (bid.BidAmount > auctionItem.MinimumBid) {
                bid.AuctionItem = auctionItem;
                auctionItem.MinimumBid = bid.BidAmount;

                _db.SaveChanges();
            }
        }
Beispiel #3
0
        public void PlaceBid(Bid bid, AuctionItem auctionItem)
        {
            if (bid.BidAmount > auctionItem.MinimumBid)
            {
                bid.AuctionItem        = auctionItem;
                auctionItem.MinimumBid = bid.BidAmount;

                _db.SaveChanges();
            }
        }
        public AuctionItemCreateViewModel(AuctionItem a) : this()
        {
            AuctionItemID = a.AuctionItemID;
            Name          = a.Name;
            Description   = a.Description;
            MinPrice      = a.MinPrice;
            EndDateTime   = a.EndDateTime;

            SelectedCategory = a.Category.CategoryID;
            Images           = a.Images;
        }
Beispiel #5
0
        public AuctionItemBidViewModel(AuctionItem a, Bid b)
        {
            AuctionItemID = a.AuctionItemID;
            Name          = a.Name;
            Description   = a.Description;
            MinPrice      = a.MinPrice;
            EndDateTime   = a.EndDateTime;
            User          = a.User;
            Category      = a.Category;
            Images        = a.Images;

            Bid = b;
        }
        public ActionResult Edit(int id, AuctionItem item)
        {
            try
            {
                _repo.SaveAuctionItem(item);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Beispiel #7
0
 public void SaveAuctionItem(AuctionItem item)
 {
     AuctionItem newItem;
     if (item.Id != 0) {
         newItem = GetAuctionItemById(item.Id);
         newItem.Name = item.Name;
         newItem.Description = item.Description;
         newItem.CurrentBids = item.CurrentBids;
         newItem.MinimumBid = item.MinimumBid;
         newItem.MaximumBids = item.MaximumBids;
     } else {
         _db.AuctionItems.Add(item);
     }
     _db.SaveChanges();
 }
Beispiel #8
0
        public void SaveAuctionItem(AuctionItem item)
        {
            if (item.Id != 0) {
                var dbItem = GetAuctionItemById(item.Id);
                dbItem.Name = item.Name;
                dbItem.MinimumBid = item.MinimumBid;
                dbItem.Description = item.Description;
                dbItem.NumberOfBids = item.NumberOfBids;
            }
            else {
                _db.AuctionItems.Add(item);
            }

            _db.SaveChanges();
        }
Beispiel #9
0
        public void SaveAuctionItem(AuctionItem item)
        {
            if (item.Id != 0)
            {
                var dbItem = GetAuctionItemById(item.Id);
                dbItem.Name         = item.Name;
                dbItem.MinimumBid   = item.MinimumBid;
                dbItem.Description  = item.Description;
                dbItem.NumberOfBids = item.NumberOfBids;
            }
            else
            {
                _db.AuctionItems.Add(item);
            }

            _db.SaveChanges();
        }
 public ActionResult Create(AuctionItem collection)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid) {
             _repo.SaveAuctionItem(collection);
             return RedirectToAction("Index");
         } else {
             return View();
         }
     }
     catch
     {
         return View();
     }
 }