public ActionResult DeleteConfirmed(int id) { Miniature miniature = MiniatureDB.GetMiniatureById(id); MiniatureDB.DeleteMiniature(miniature); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Miniid,Name,Price,Description,Year,GameName,Faction,Speed,Attack,Strength,HitPoints,Defense")] Miniature miniature) { if (ModelState.IsValid) { MiniatureDB.UpdateMiniature(miniature); return(RedirectToAction("Index")); } return(View(miniature)); }
// GET: Miniatures/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Miniature miniature = MiniatureDB.GetMiniatureById(id); if (miniature == null) { return(HttpNotFound()); } return(View(miniature)); }
// GET: Miniatures public ActionResult Index(int?id) { int page = id ?? 1; const byte PageSize = 15; ViewBag.CurrentPage = page; List <Miniature> prods = MiniatureDB.GetProductsByPage(page, PageSize); int numProducts = MiniatureDB.GetTotalProducts(); int maxPage = (int)Math.Ceiling(numProducts / (double)PageSize); ViewBag.MaxPage = maxPage; return(View(prods)); }