/// <summary> /// Update entity /// </summary> /// <param name="entity">Entity</param> public virtual int Update(T entity) { try { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } Entities.Attach(entity); _context.Entry(entity).State = EntityState.Modified; return(_context.SaveChanges()); } catch (Exception ex) { throw new Exception(GetFullErrorTextAndRollbackEntityChanges(ex), ex); } }
public virtual T Update(T entity) { dbContext.Entry(entity).State = EntityState.Modified; dbContext.SaveChanges(); return(entity); }
public User Update(User entity) { dbContext.Entry(entity).State = EntityState.Modified; dbContext.SaveChanges(); return(entity); }