public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,BirthDate,DeathDate,IsMale,Father,Mother,DataOwnerId")] Person person) { if (ModelState.IsValid) { _context.Add(person); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } SavePotentialParentsAndSexesInViewData(person); return(View(person)); }
public async Task <IActionResult> Create([Bind("Id,Firstname,Lastname,Birthdate,Deathdate,Father,Mother,Ismale")] Person person) { if (ModelState.IsValid) { _context.Add(person); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Father"] = new SelectList(_context.Person, "Id", "Id", person.Father); ViewData["Mother"] = new SelectList(_context.Person, "Id", "Id", person.Mother); return(View(person)); }