public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Country,Wool,Size,Lifetime,Photo")] Species species) { if (id != species.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(species); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpeciesExists(species.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(species)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Photo,SpeciesId,Age,Info")] Cats cats) { if (id != cats.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cats); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatsExists(cats.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cats)); }