Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Miniature miniature = MiniatureDB.GetMiniatureById(id);

            MiniatureDB.DeleteMiniature(miniature);
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 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));
 }
Exemple #3
0
        // 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));
        }
Exemple #4
0
        // 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));
        }