예제 #1
0
 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));
 }
예제 #2
0
 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));
 }
예제 #3
0
        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));
        }