public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,Street,City,EmailAddress,PhoneNumber,Occupation")] Owner owner) { if (id != owner.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(owner); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OwnerExists(owner.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(owner)); }
public async Task <IActionResult> Edit(int id, [Bind("PetID,Name,DOB,Breed,OwnerID")] Pet pet) { if (id != pet.PetID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pet); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PetExists(pet.PetID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["OwnerID"] = new SelectList(_context.Owner, "ID", "FullName", pet.OwnerID); return(View(pet)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,DOB,OwnderId")] Pet pet) { if (id != pet.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pet); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PetExists(pet.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pet)); }