private async Task <IEnumerable <Contact> > GetContacts() { var contacts = await _storage.Get(FILENAME); if (contacts == null) { contacts = await _storage.Save(new Contact[] { new Contact { Id = 1, EmailAddress = "*****@*****.**", Name = "Barney Poland" }, new Contact { Id = 2, EmailAddress = "*****@*****.**", Name = "Lacy Barrera" }, new Contact { Id = 3, EmailAddress = "*****@*****.**", Name = "Lora Riggs" } } , FILENAME); } var contactsList = contacts.ToList <Contact>(); //Uncomment the following using block to call the CompanyContacts API //using (var client = CompanyContactsAPIClientWithAuth()) //{ // var results = await client.Contacts.GetAsync(); // foreach (Contact c in results) // { // contactsList.Add(c); // } //} return(contactsList); }
private IEnumerable <Product> GetInventory() { var inventory = _storage.Get(FILENAME); if (inventory == null) { //Populate with some dummy data to begin with inventory = GetDefaultProducts(); _storage.Save( inventory, FILENAME); } return(inventory); }
private async Task <IEnumerable <Country> > GetCountries() { var countries = await _storage.Get <Country>(FILENAME); if (countries == null) { await _storage.Save(new [] { new Country { Id = 1, Name = "Norway", CountryCode = "NO" }, new Country { Id = 2, Name = "USA", CountryCode = "US" }, new Country { Id = 3, Name = "England", CountryCode = "ENG" } }, FILENAME); } return(countries); }
private async Task <IEnumerable <Contact> > GetContacts() { var contacts = await _storage.Get(FILENAME); if (contacts == null) { await _storage.Save(new Contact[] { new Contact { Id = 1, EmailAddress = "*****@*****.**", Name = "Barney Poland" }, new Contact { Id = 2, EmailAddress = "*****@*****.**", Name = "Lacy Barrera" }, new Contact { Id = 3, EmailAddress = "*****@*****.**", Name = "Lora Riggs" } } , FILENAME); } return(contacts); }
private async Task <IEnumerable <VideoGame> > GetVideoGames() { var contacts = await _storage.Get <VideoGame>(FILENAME); if (contacts == null) { await _storage.Save(new VideoGame[] { new VideoGame { Id = 1, Name = "Call of Duty: Modern Warfare", Genre = "Action", Platform = "XBox One" }, new VideoGame { Id = 2, Name = "Mega Man", Genre = "Adventure", Platform = "Nintendo Entertainment System" }, new VideoGame { Id = 3, Name = "FIFA 16", Genre = "Sport", Platform = "Xbox One" } } , FILENAME); } return(contacts); }