public async Task <IActionResult> Edit(int id, [Bind("Id,Variety")] Apple apple) { if (id != apple.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(apple); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppleExists(apple.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(apple)); }
public virtual void Atualizar(TEntity obj) { DetachAll(); Db.Update(obj); }