public async Task <IActionResult> Create([Bind("MeetingDate,OpeningHymn,IntermediateHymn,ClosingHymn")] Sacrament sacrament) { try { if (ModelState.IsValid) { _context.Add(sacrament); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } catch (DbUpdateException /* ex */) { //Log the error (uncomment ex variable name and write a log. ModelState.AddModelError("", "Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator."); } return(View(sacrament)); }
public async Task <IActionResult> Create([Bind("FirstName,LastName,Bishopric")] Member member) { try { if (ModelState.IsValid) { _context.Add(member); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } catch (DbUpdateException /* ex */) { //Log the error (uncomment ex variable name and write a log. ModelState.AddModelError("", "Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator."); } return(View(member)); }