예제 #1
0
        public ActionResult Create(CreatorHero1 hero)

        {
            try
            {
                db.hero1s.Add(hero);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #2
0
        public ActionResult Delete(int id, CreatorHero1 hero)
        {
            try
            {
                CreatorHero1 removeHero = db.hero1s.Find(id);
                db.hero1s.Remove(removeHero);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #3
0
        public ActionResult Edit(int id, CreatorHero1 hero)
        {
            try
            {
                CreatorHero1 editHero = db.hero1s.Find(id);
                editHero.Name             = hero.Name;
                editHero.AlterEgo         = hero.AlterEgo;
                editHero.PrimartyAbility  = hero.PrimartyAbility;
                editHero.SecondaryAbility = hero.SecondaryAbility;
                editHero.CatchPhrase      = hero.CatchPhrase;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #4
0
        // GET: Heros/Delete/5
        public ActionResult Delete(int id)
        {
            CreatorHero1 removeHero = db.hero1s.Where(h => h.Id == id).SingleOrDefault();

            return(View(removeHero));
        }
예제 #5
0
        // GET: Heros/Edit/5
        public ActionResult Edit(int id)
        {
            CreatorHero1 editHero = db.hero1s.Where(h => h.Id == id).SingleOrDefault();

            return(View(editHero));
        }
예제 #6
0
        // GET: Heros/Create
        public ActionResult Create()
        {
            CreatorHero1 newHero = new CreatorHero1();

            return(View(newHero));
        }
예제 #7
0
        // GET: Heros/Details/5
        public ActionResult Details(int id)
        {
            CreatorHero1 SuperHero = db.hero1s.Where(h => h.Id == id).SingleOrDefault();

            return(View(SuperHero));
        }