Example #1
0
        public virtual TEntity Adicionar(TEntity entity)
        {
            _dbContext.Set <TEntity>().Add(entity);
            _dbContext.SaveChanges();

            return(entity);
        }
Example #2
0
        public async Task <TEntity> AddAsync(TEntity entity)
        {
            await _context.Set <TEntity>().AddAsync(entity);

            await _context.SaveChangesAsync();

            return(entity);
        }
Example #3
0
 public Repository(ClienteContext Context)
 {
     this.Context = Context;
     this.Context.Database.Migrate();
     Db = Context.Set <T>();
 }
Example #4
0
        } //constructor

        public virtual T Add(T entity)
        {
            _context.Set <T>().Add(entity);
            _context.SaveChanges();
            return(entity);
        } //Add
Example #5
0
 public TipoRepository(ClienteContext Context) : base(Context)
 {
     Db = Context.Set <Tipo>();
 }
Example #6
0
 public Repository(ClienteContext context)
 {
     Db    = context;
     DbSet = Db.Set <TEntity>();
 }
Example #7
0
 //o virtual serve para aplicar polimorfismo, o método será sobescrito
 public virtual TEntity Adicionar(TEntity entity)
 {
     _dbContext.Set <TEntity>().Add(entity); //adicionando ao banco
     _dbContext.SaveChanges();               // salvando no banco
     return(entity);
 }
Example #8
0
 public Repository(ClienteContext db)
 {
     Db    = db;
     DbSet = Db.Set <TEntity>();
 }
Example #9
0
 public virtual T Adicionar(T entity)
 {
     _dbcontext.Set <T>().Add(entity);
     _dbcontext.SaveChanges();
     return(entity);
 }
Example #10
0
 public Repository(ClienteContext context)
 {
     _context  = context;
     _entities = context.Set <TEntity>();
 }
Example #11
0
 public BaseRepository(ClienteContext context, IVariablesToken variables)
 {
     _context   = context;
     _variables = variables;
     DbSet      = _context.Set <TEntity>();
 }
Example #12
0
 public virtual TEntity Adicionar(TEntity entity)
 {
     _dbContext.Set <TEntity>().Add(entity);
     _dbContext.SaveChanges(); // persistencia de dados...
     return(entity);
 }