public async Task <IActionResult> Create([Bind("OwnerId,FirstName,LastName,email,Photo,PhoneNumber")] Owner owner) { if (ModelState.IsValid) { _context.Add(owner); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(owner)); }
public async Task <IActionResult> Create([Bind("PetId,Name,OwnerId,Age,Picture")] Pet pet) { if (ModelState.IsValid) { _context.Add(pet); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OwnerId"] = new SelectList(_context.Owners, "OwnerId", "OwnerId", pet.OwnerId); return(View(pet)); }