public Task <int> UpdateAsync <TEntity>(TEntity entity) where TEntity : class
 {
     dbcontext.Set <TEntity>().Attach(entity);
     PropertyInfo[] props = entity.GetType().GetProperties();
     foreach (PropertyInfo prop in props)
     {
         if (prop.GetValue(entity, null) != null && prop.Name != "Id")
         {
             if (prop.GetValue(entity, null).ToString() == "&nbsp;")
             {
                 dbcontext.Entry(entity).Property(prop.Name).CurrentValue = null;
             }
             dbcontext.Entry(entity).Property(prop.Name).IsModified = true;
         }
     }
     return(dbTransaction == null?this.CommitAsync() : Task.FromResult(0));
 }
Esempio n. 2
0
 public Task <List <TEntity> > GetAllAsync()
 {
     return(dbcontext.Set <TEntity>().ToListAsync());
 }