I have a controller class and has one method which has tableName as parameter.
and can have switch cases for up to 30 tables/cases.

**Controller**

```
    public async Task<IActionResult> GetData(string tableName, string pRtUnique)
    {

        var tableEnum = Enum.Parse<AssetInitial>(tableName);
        switch (tableEnum )
        {
            case AssetInitial.Table1:
                return Ok(ApiResult<List<Table1>>.Success200(await _extractService.GetDataAsync<Table1>(pRtUnique)));
                break;
            case AssetInitial.Table2: ..... break;
            case AssetInitial.Table3: ..... break;

             case AssetInitial.Table30: ..... break;

        }

    }

```

**Interface**

```
 public interface IExtractService
    {
        public Task<List<TEntity>> GetDataAsync<TEntity>( string pRtUnique) where TEntity : BaseEntity;

}        

```

**Implementation**:

```
  public class ExtractService : IExtractService
    {
        private readonly DbContext _context;

        public ExtractService(DbContext  context)
        {
            _context = context;
        }

        public async Task<List<TEntity>> GetDataAsync<TEntity>(string pRtUnique) where TEntity : BaseEntity
        {
            return await _context.Set<TEntity>().Where(x => x.RtUnique== pRtUnique).ToListAsync();
        }

    }

```

Can I have generic one code/call from controller class based on table. Don't like simply have a switch statement for 30 conditions to just retrieve data from table. HI hope you have understood the challenge currently I am going with. Can I have one method call which should work for all tables ?