Exemple #1
0
        public override async Task <BaseReply> CreateTable(TableRequest request, ServerCallContext context)
        {
            try
            {
                await _databaseService.AddTable(request.DbName, request.TableName);

                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("***************************************************************************************************************");
                Console.WriteLine("Table created: " + request.TableName);
                Console.WriteLine("***************************************************************************************************************");

                return(new BaseReply()
                {
                    Code = 200
                });
            }
            catch (Exception ex)
            {
                return(new BaseReply()
                {
                    Code = 400, Message = ex.Message, StackTrace = ex.StackTrace
                });
            }
        }
Exemple #2
0
        public async Task <ActionResult <RequestResult> > AddTable(string dbName, [FromQuery] string tableName)
        {
            RequestResult result = await _dataBase.AddTable(dbName, tableName);

            if (result.IsSuccess)
            {
                return(Ok(result));
            }
            else
            {
                return(BadRequest(result));
            }
        }