public override async Task <GetEntityReply> GetTable(GetEntityRequest request, ServerCallContext context) { try { var table = await _databaseService.GetTable(request.DbName, request.TableName); GetEntityReply response = _grpcModelMapper.GetGetEntityReplyFromTableDto(table.table); response.Code = 200; Console.WriteLine(); Console.WriteLine(); Console.WriteLine("***************************************************************************************************************"); Console.WriteLine("Get table: " + request.TableName); Console.WriteLine("***************************************************************************************************************"); return(response); } catch (Exception ex) { return(new GetEntityReply() { Code = 400, Message = ex.Message, StackTrace = ex.StackTrace }); } }
public async Task <ActionResult <Table> > GetTable(string dbName, [FromQuery] string tableName) { (Table table, RequestResult result)result = await _dataBase.GetTable(dbName, tableName); if (result.result.IsSuccess) { return(Ok(result.table)); } else { return(BadRequest(result.result)); } }