Ejemplo n.º 1
0
        public TEntity Add(TEntity entity)
        {
            dbContext.Set <TEntity>().Add(entity);
            dbContext.SaveChanges();

            return(entity);
        }
Ejemplo n.º 2
0
        public async Task <TEntity> Add(TEntity entity)
        {
            PhoneBookContext.Set <TEntity>().Add(entity);
            await PhoneBookContext.SaveChangesAsync();

            return(entity);
        }
Ejemplo n.º 3
0
        public async Task Insert <T>(T model) where T : class
        {
            await _db.Set <T>().AddAsync(model);

            await _db.SaveChangesAsync();
        }
Ejemplo n.º 4
0
 public GenericRepository(PhoneBookContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }