Exemplo n.º 1
0
        public async Task <TEntity> GetByIdAsync(object id)
        {
            var currentId = int.Parse(id.ToString());
            Expression <Func <TEntity, bool> > predicate = t => t.Id == currentId;

            return(await EntityContext.Set <TEntity>().FirstOrDefaultAsync(predicate));
        }
Exemplo n.º 2
0
 public RepositoryBase(MarvelContext context)
 {
     EntityContext = context;
     EntityDbSet   = EntityContext.Set <TEntity>();
 }
Exemplo n.º 3
0
 public async Task <T> GetById(int id) => await _context.Set <T>().FindAsync(id).AsTask();