Exemplo n.º 1
0
        public IActionResult GetHeros()
        {
            var heroService = new HeroRepository();
            var heroes      = heroService.GetAllHeroes();

            if (heroes.Count == 0)
            {
                return(NotFound());
            }
            return(Ok(heroes));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            HeroRepository repo      = new HeroRepository();
            var            allHeroes = repo.GetAllHeroes();

            foreach (var hero in allHeroes)
            {
                Console.WriteLine($"Id: {hero.Id}, Name: {hero.Name}");
            }

            Console.ReadLine();
        }