public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,Street,City,EmailAddress,PhoneNumber,Occupation")] Owner owner) { if (ModelState.IsValid) { _context.Add(owner); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(owner)); }
public async Task <IActionResult> Create([Bind("ID,Name,DOB,Breed,OwnerId")] Pet pet) { if (ModelState.IsValid) { _context.Add(pet); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OwnerId"] = new SelectList(_context.Owner, "ID", "FullName", pet.OwnerId); return(View(pet)); }