public ActionResult Delete(Pokemon pokemon) { var service = new PokemonService(); service.Deletar(pokemon.Id); return(View("Index", service.FindAll())); }
public ActionResult Delete(int id) { var service = new PokemonService(); service.Deletar(id); var all = service.FindAll(); Session["ListaPessoas"] = all; return(View("Index", all)); }
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)); }
public ActionResult Index() { var service = new PokemonService(); List <Pokemon> allPokemons = service.FindAll(); if (Session["ListaPessoas"] == null) { Session["ListaPessoas"] = allPokemons; } return(View(allPokemons)); }
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)); }