// To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } var now = DateTime.Now; var premiseContact = new PremiseContact { FirstName = Contact.FirstName, LastName = Contact.LastName, PhoneNumber = Contact.PhoneNumber, MobileNumber = Contact.MobileNumber, Email = Contact.Email, PremiseId = Contact.PremiseId, IsActive = true, IsDeleted = false, CreatedAt = now, UpdatedAt = now }; _context.PremiseContacts.Add(premiseContact); await _context.SaveChangesAsync(); return(RedirectToPage("./MemberIndex")); }
public async Task <IActionResult> OnGetAsync(long?id) { if (id == null) { return(NotFound()); } Contact = await _context.PremiseContacts.FirstOrDefaultAsync(m => m.Id == id); if (Contact == null) { return(NotFound()); } return(Page()); }