public async Task <HttpResponseMessage> GetTableInfo(HttpRequestMessage request, [FromBody] CreateTableScriptViewModel vm) { IDataGenStrategy dataGenStrategy = DataGenStrategies[vm.SqlType]; TableInfo tableInfo = await dataGenStrategy.GetTableInfoAsync(vm.CreateTableScript); TableInfoViewModel tableInfoViewModel = new TableInfoViewModel { TableInfo = tableInfo }; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, tableInfoViewModel); return(response); }
public async Task <HttpResponseMessage> GetGeneratedData(HttpRequestMessage request, [FromBody] TableInfoViewModel vm) { IDataGenStrategy dataGenStrategy = DataGenStrategies[vm.SqlType]; var generationOptions = new InsertScriptGenerationOptions { RowCount = vm.EntityCount }; string generatedData = await dataGenStrategy.GenerateInsertScriptAsync(vm.TableInfo, generationOptions); GeneratedDataViewModel generatedDataViewModel = new GeneratedDataViewModel { GeneratedData = generatedData }; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, generatedDataViewModel); return(response); }