public async Task <IActionResult> Index() { var people = await _contactProvider.GetPeople(); var emails = await _contactProvider.GetEmailAddresses(); var phoneNumbers = await _contactProvider.GetPhoneNumbers(); var streetAddresses = await _contactProvider.GetStreetAddresses(); var peopleTwo = await _contactProvider.GetPeople(); var toBeDelete = people.ElementAt(1); await _contactProvider.DeletePerson(toBeDelete.Id); await _contactProvider.Commit(); var newListOfPeople = await _contactProvider.GetPeople(); var newListOfemails = await _contactProvider.GetEmailAddresses(); var newListOfphoneNumbers = await _contactProvider.GetPhoneNumbers(); var newListOFstreetAddresses = await _contactProvider.GetStreetAddresses(); return(View(new { people, peopleTwo, emails, phoneNumbers, streetAddresses })); }
public async Task CreateSampleData() { await Task.Run(async() => { var people = RandomPeople().Take(20).ToList(); //Prevent lazy loading foreach (var person in people) { await _contactProvider.AddPerson(person); } await _contactProvider.Commit(); }); }