public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Street,City,PhoneNumber,EmailAddress,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)); }