public IActionResult OnPost() { if (!ModelState.IsValid) { ContactTypes = htmlHelper.GetEnumSelectList <ContactType>(); return(Page()); } if (Contact.Id > 0) { contactData.Update(Contact); } else { contactData.Add(Contact); } contactData.Commit(); TempData["Message"] = "Contact Saved!"; return(RedirectToPage("./Detail", new { contactId = Contact.Id })); }
public IActionResult OnPost() { if (!ModelState.IsValid) { Nationalities = htmlHelper.GetEnumSelectList <NationalityType>(); return(Page()); } if (contact.Id > 0) { contactData.Update(contact); TempData["Message"] = "Contact has been updated."; } else { contactData.Add(contact); TempData["Message"] = "New Contact has been created."; } contactData.Commit(); return(RedirectToPage("./Detail", new { contactId = contact.Id })); }