예제 #1
0
        public IActionResult Delete(Pokedex.Models.Type type)
        {
            using (DBPokedexContext db = new DBPokedexContext())
            {
                db.Type.Remove(type);
                db.SaveChanges();

                return(RedirectToAction("Index", "Type"));
            }
        }
예제 #2
0
        public IActionResult Edit(Pokedex.Models.Type type)
        {
            if (ModelState.IsValid)
            {
                using (DBPokedexContext db = new DBPokedexContext())
                {
                    Pokedex.Models.Type Type2 = db.Type.Find(type.Id);
                    Type2.Name = type.Name.ToLower();
                    db.SaveChanges();

                    return(RedirectToAction("Index", "Type"));
                }
            }
            else
            {
                return(View());
            }
        }