Example #1
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var entry = _context.Add(new Member());

            entry.CurrentValues.SetValues(Member);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Example #2
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var newIdentity = new MemberIdentity();

            newIdentity.WhenCreated        = DateTime.Now;
            newIdentity.MemberDetailsState = MemberDetailsState.Pending;
            newIdentity.MemberId           = 1;
            var entry = _context.Add(newIdentity);

            entry.CurrentValues.SetValues(MemberIdentity);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }