Example #1
0
        public virtual async Task <bool> Update(TEntity entity)
        {
            try
            {
                DbSet.Attach(entity);
                _context.Entry(entity).State = EntityState.Modified;

                return(await Task.FromResult(true));
            }
            catch (Exception)
            {
                return(await Task.FromResult(false));
            }
        }
Example #2
0
 public virtual void Update(T entity)
 {
     _dbContext.Entry(entity).CurrentValues.SetValues(entity);
 }
Example #3
0
 public Task Update <T>(T entity) where T : Entity
 {
     _dbContext.Entry(entity).State = EntityState.Modified;
     return(_dbContext.SaveChangesAsync());
 }