Exemplo n.º 1
0
 public async Task <ActionResult <Dataset> > Post([FromBody] DatasetInput datasetInput)
 {
     if (datasetInput.Data == null || datasetInput.Data.Length == 0)
     {
         return(BadRequest(new { errorMessage = "Input does not contain any data" }));
     }
     else
     {
         try
         {
             int result = await datasetService.CreateNewDataset(datasetInput.Name, datasetInput.Description, parser.Parse(datasetInput));
         } catch (DatasetParserException ex) {
             _logger.LogError(ex, $"{ex.Message}\n{ex.StackTrace}");
             return(BadRequest(new { errorMessage = "Invalid data format. Input file should contain rows with two space separated numbers" }));
         }
     }
     return(StatusCode(201));
 }
Exemplo n.º 2
0
 private void CreateTestDataset(DatasetInput datasetInput)
 {
     dbContext.Database.EnsureDeleted();
     dbContext.Database.EnsureCreated();
     datasetService.CreateNewDataset(datasetInput.Name, datasetInput.Description, parser.Parse(datasetInput));
 }