public ActionResult Bid(Bid bid)
        {
            var db = new MvcAuction.Models.AuctionsDBContext();
            var auction = db.Auctions.Find(bid.AuctionId);
            if (auction == null)
            {
                ModelState.AddModelError("AuctionId", "Auction Not Found!");
            }
            else if (auction.CurrentPrice >= bid.Amount)
            {
                ModelState.AddModelError("Amount", "Bid Amount Must Exceed Current Bid");
            }
            else
            {
                bid.Username = User.Identity.Name;
                auction.Bids.Add(bid);
                auction.CurrentPrice = bid.Amount;
                db.SaveChanges();
            }

            if (!Request.IsAjaxRequest())
                return RedirectToAction("Auction", new { id = bid.AuctionId});
            return Json
                (
                    new {
                            CurrentPrice = bid.Amount.ToString("C"),
                            BidCount = auction.BidCount
                        }
                );
        }
        public ActionResult Create([Bind (Exclude ="CurrentPrice")]Models.Auction auction)
        {
            if (ModelState.IsValid)
            {
                //Save it to the Database
                var db = new MvcAuction.Models.AuctionsDBContext();
                db.Auctions.Add(auction);
                db.SaveChanges();

                return RedirectToAction("Index");
            }
                   
            return Create();
        }
 public ActionResult Index()
 {
     var db = new MvcAuction.Models.AuctionsDBContext();
     var auctions = db.Auctions;
     return View(auctions);
 }