Exemple #1
0
        public List <Character> GetCharactersRandomly(int?offset = 0)
        {
            List <Character> heroes = new List <Character>();

            Marvel.Api.Filters.CharacterRequestFilter f = new Marvel.Api.Filters.CharacterRequestFilter();
            //f.OrderBy(OrderResult.NameAscending);
            f.Limit  = 100;
            f.Offset = offset;

            Random random = new Random();
            int    i      = 1;

            while (i <= 10)
            {
                int index = random.Next(1, 100);
                List <Character> result = client.FindCharacters(f).Data.Results;
                Character        c      = result.ElementAt(index);
                if (c.Name == "" || c.Description == "" || c.Thumbnail == null && i > 10)
                {
                    continue;
                }
                heroes.Add(c);
                i++;
            }
            return(heroes);
        }
Exemple #2
0
        public List <Character> GetCharacters(int?offset = 0)
        {
            List <Character> heroes = new List <Character>();

            Marvel.Api.Filters.CharacterRequestFilter f = new Marvel.Api.Filters.CharacterRequestFilter();
            f.OrderBy(OrderResult.NameAscending);
            f.Offset = offset;
            CharacterResult r = client.FindCharacters(f);
            int             i = 1;

            foreach (Character c in r.Data.Results)
            {
                if (c.Name == "" || c.Description == "" || c.Thumbnail == null && i > 10)
                {
                    continue;
                }
                heroes.Add(c);
                i++;
            }
            return(heroes);
        }