コード例 #1
0
        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 }));
        }
コード例 #2
0
ファイル: MockPeople.cs プロジェクト: discord-csharp/pouarf
        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();
            });
        }