public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,email")] Cliente cliente) { if (id != cliente.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cliente); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClienteExists(cliente.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cliente)); }
public virtual TEntity Update(TEntity entity) { // _dbSet.Attach(entity); _context.Update(entity).State = EntityState.Modified; return(entity); }
public virtual TEntity Update(TEntity entity) { _context.Update(entity).State = EntityState.Modified; _context.SaveChanges(); return(entity); }