Ejemplo n.º 1
0
        public async Task <People> GetAllPeople()
        {
            var callswapi = await SD.GetStringAsync(SD.baseUrlSwapi + "people/");

            var people = JsonConvert.DeserializeObject <People>(callswapi);

            return(people);
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <CategoriesChuck> > GetAll()
        {
            var categories = new List <CategoriesChuck>();

            categories = new List <CategoriesChuck>();
            var callchuck = await SD.GetStringAsync(SD.baseUrlChuck + "categories/");

            var listcategories = JsonConvert.DeserializeObject <object>(callchuck);

            string[] propertyNames = listcategories.GetType().GetProperties().Select(p => p.Name).ToArray();
            foreach (var prop in propertyNames)
            {
            }
            return(categories);
        }
Ejemplo n.º 3
0
        public async Task <SearchResult> SearchData(SearchData searchData)
        {
            var call_chuck = await SD.GetStringAsync(SD.baseUrlChuck + "search?query=" + searchData.q_category);

            var call_swapi = await SD.GetStringAsync(SD.baseUrlSwapi + "people/?search=" + searchData.q_people);

            var people     = JsonConvert.DeserializeObject <People>(call_swapi);
            var categories = JsonConvert.DeserializeObject <Categories>(call_chuck);

            var searchResult = new SearchResult()
            {
                People     = (People)people,
                Categories = (Categories)categories
            };

            return(searchResult);
        }
Ejemplo n.º 4
0
        public async Task <object> SearchData(SearchData searchData)
        {
            var call_chuck = await SD.GetStringAsync(SD.baseUrlChuck + "categories/" + searchData.q_category);

            var call_swapi = await SD.GetStringAsync(SD.baseUrlChuck + "people/" + searchData.q_people);

            var people     = JsonConvert.DeserializeObject <object>(call_swapi);
            var categories = JsonConvert.DeserializeObject <object>(call_chuck);

            var results = new
            {
                Chuck = call_chuck,
                Swapi = call_swapi
            };

            var chuck_swapi = JsonConvert.SerializeObject(results);

            return(chuck_swapi);
        }