public ActionResult Create(Auction auction) { if (ModelState.IsValid) { var db = new EbuyDataContext(); db.Auctions.Add(auction); db.SaveChanges(); return RedirectToAction("Details", new { id = auction.Id }); } return View(auction); }
public ActionResult Auction(long id) { var db = new EbuyDataContext(); var auction = db.Auctions.Find(id); // The following moved to MultipleResponseFormatsAttribute: /* // Respond to AJAX requests if (Request.IsAjaxRequest()) return PartialView("Auction", auction); // Respond to JSON requests if (Request.IsJsonRequest()) return Json(auction); */ // Default to a "normal" view with layout return View("Auction", auction); }
public ActionResult PartialAuction(long id) { var db = new EbuyDataContext(); var auction = db.Auctions.Find(id); return PartialView("Auction", auction); }
public ActionResult JsonAuction(long id) { var db = new EbuyDataContext(); var auction = db.Auctions.Find(id); return Json(auction, JsonRequestBehavior.AllowGet); }
public ActionResult Index(int page = 0, int size = 25) { var db = new EbuyDataContext(); var auctions = db.Auctions.OrderByDescending(x => x.EndTime).Skip(page * 25).Take(size); return View("Auctions", auctions); }