Esempio n. 1
0
        public async Task <int> AddAsync(TEntity entity)
        {
            DbSet <TEntity> dbSet = context.Set <TEntity>();

            dbSet.Add(entity);
            context.Entry(entity).State = EntityState.Added;
            return(await context.SaveChangesAsync());
        }
Esempio n. 2
0
 public static async Task <int> UpdateAsync(TEntity entity)
 {
     using (var context = new TalentAcquisitionEntities())
     {
         DbSet <TEntity> dbSet = context.Set <TEntity>();
         dbSet.Attach(entity);
         context.Entry(entity).State = EntityState.Modified;
         return(await context.SaveChangesAsync());
     }
 }