-
-
Save BryanOroxon/cf59d07a79772f93bbd5511ee06c5f6b to your computer and use it in GitHub Desktop.
WebDataService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GifInMotion.Models; | |
using GifInMotion.Services; | |
using System.Collections.Generic; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Xamarin.Forms; | |
[assembly: Dependency(typeof(WebDataService))] | |
namespace GifInMotion.Services | |
{ | |
public class WebDataService : IDataService | |
{ | |
HttpClient httpClient; | |
HttpClient Client => httpClient ?? (httpClient = new HttpClient()); | |
public async Task<IEnumerable<Movies>> GetMoviesAsync() | |
{ | |
var json = await Client.GetStringAsync("https://raw.githubusercontent.com/BryanOroxon/GifInMotion/master/GifInMotion/GifInMotion/Data/movie.json"); | |
var all = Movies.FromJson(json); | |
return all; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment