コード例 #1
0
        public ActionResult Delete(Pokemon pokemon)
        {
            var service = new PokemonService();

            service.Deletar(pokemon.Id);

            return(View("Index", service.FindAll()));
        }
コード例 #2
0
        public ActionResult Delete(int id)
        {
            var service = new PokemonService();

            service.Deletar(id);
            var all = service.FindAll();

            Session["ListaPessoas"] = all;

            return(View("Index", all));
        }
コード例 #3
0
        public ActionResult Index()
        {
            var            service     = new PokemonService();
            List <Pokemon> allPokemons = service.FindAll();

            //ToDo: Passar o allPokemons para a view model
            //Opcional: Criar uma view model para passar para a tela ao invés de passar a model do banco
            List <PokemonViewModel> allPokemonsVms = (from x in allPokemons select new PokemonViewModel(x)).ToList();

            return(View(allPokemonsVms));
        }
コード例 #4
0
        public ActionResult Index()
        {
            var            service     = new PokemonService();
            List <Pokemon> allPokemons = service.FindAll();

            if (Session["ListaPessoas"] == null)
            {
                Session["ListaPessoas"] = allPokemons;
            }

            return(View(allPokemons));
        }
コード例 #5
0
        public ActionResult Check(int id)
        {
            var service = new PokemonService();

            var pokemon = service.BuscarPorID(id);

            pokemon.CurrentHave = !pokemon.CurrentHave;


            service.Salvar(pokemon);

            var all = service.FindAll();

            Session["ListaPessoas"] = all;

            return(View("Index", all));
        }