Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            RPG_HeroContext context = new RPG_HeroContext();

            context.DeleteHero(id);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        // GET: Hero/Delete/5
        public ActionResult Delete(int id)
        {
            RPG_HeroContext context = new RPG_HeroContext();
            Hero            hero    = context.GetHeroById(id);

            return(View(hero));
        }
Ejemplo n.º 3
0
        public ActionResult Edit([Bind(Include = "Id,Health,Lvl,AttackPower,CurrentExp")] Hero hero)
        {
            RPG_HeroContext context = new RPG_HeroContext();

            context.EditById(hero);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
        // GET: Hero
        public ActionResult Index()
        {
            RPG_HeroContext context = new RPG_HeroContext();
            List <Hero>     heroes  = context.getAllHeroes();

            return(View(heroes));
        }
Ejemplo n.º 5
0
        public ActionResult Create(Hero hero)
        {
            hero.Health      = Int32.Parse(Request.Form["Health"].ToString());
            hero.Lvl         = Int32.Parse(Request.Form["Lvl"].ToString());
            hero.AttackPower = Int32.Parse(Request.Form["AttackPower"].ToString());
            hero.CurrentExp  = hero.Lvl = Int32.Parse(Request.Form["CurrentExp"].ToString());

            RPG_HeroContext context = new RPG_HeroContext();

            context.Create(hero);

            return(RedirectToAction("Index"));
        }