public override async Task <GetTableListReply> GetTableList(GetTableListRequest request, ServerCallContext context) { try { var tables = await _databaseService.GetTables(request.DbName); GetTableListReply response = new GetTableListReply { Code = 200, }; response.Tables.AddRange(tables.tables.Select(x => x.Name)); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("***************************************************************************************************************"); Console.WriteLine("Get tables from db: " + request.DbName); Console.WriteLine("***************************************************************************************************************"); return(response); } catch (Exception ex) { return(new GetTableListReply() { Code = 400, Message = ex.Message, StackTrace = ex.StackTrace }); } }
public async Task <ActionResult <List <Table> > > GetTables(string dbName) { (List <Table> tables, RequestResult result)result = await _dataBase.GetTables(dbName); if (result.result.IsSuccess) { return(Ok(result.tables)); } else { return(BadRequest(result.result)); } }