public async Task <IActionResult> OnPostSavePerson()
        {
            if (Person == null)
            {
                await _context.AddAsync(Person);
            }
            else
            {
                _context.Update(Person);
            }

            await _context.SaveChangesAsync();

            return(RedirectToPage("Person"));
        }
コード例 #2
0
        public async Task AddAsync(PhoneNumber phoneNumber)
        {
            await _context.AddAsync(phoneNumber);

            await _context.SaveChangesAsync();
        }