public async Task <IActionResult> Edit(int id, [Bind("PetID,Name,DateOfBirth,Specie")] 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))); } return(View(pet)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,OwnerID,UserName,Password")] Account account) { if (id != account.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(account); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccountExists(account.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["OwnerID"] = new SelectList(_context.Owners, "OwnerID", "Adress", account.OwnerID); return(View(account)); }
public async Task <IActionResult> Edit(int id, [Bind("OwnerID,FirstName,LastName,DateOfBirth,Adress,PhoneNumber,EmailAdress")] Owner owner) { if (id != owner.OwnerID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(owner); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OwnerExists(owner.OwnerID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(owner)); }