public ActionResult Details(int?id) { if (id.HasValue) { AuctionItem a = AuctionItemDB.GetAuctionItemByID(db, id.Value); if (a != null) { return(View(a)); } } return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); }
public ActionResult Update(int?id) { if (id.HasValue) { AuctionItem a = AuctionItemDB.GetAuctionItemByID(db, id.Value); if (a != null) { var v = new AuctionItemCreateViewModel(a); return(View(v)); } } return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); }
public ActionResult Bid(int?AuctionItemID, decimal amount) { if (AuctionItemID.HasValue) { AuctionItem a = AuctionItemDB.GetAuctionItemByID(db, AuctionItemID.Value); if (a != null) { if (a.User.Id == User.Identity.GetUserId() || amount < a.MinPrice) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BidDB.CreateOrUpdate(db, new Bid(User.Identity.GetUserId(), AuctionItemID.Value, amount)); return(RedirectToAction("Details", new { id = a.AuctionItemID })); } } return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); }