public async Task <IActionResult> Generation([FromBody] GenerationDataRequest requestData) { var generationModel = _mapper.Map <GenerationModel>(requestData); await _generationService.Add(generationModel); return(new OkResult()); }
public Task <SerializationSet> GetGenerationDataAsync(string databaseName, [FromBody] GenerationDataRequest request) { var runtimeService = this.cremaHost.GetService(typeof(IRuntimeService)) as IRuntimeService; if (runtimeService == null) { throw new NullReferenceException(nameof(runtimeService)); } var result = runtimeService.GetDataGenerationData(databaseName, request.Tags, request.FilterExpression, request.IsDevMode, request.Revision); result.Validate(); return(Task.FromResult(result.Value)); }
public async Task SendGenerationData(GenerationDataRequest requestData) { if (!_enabled) { return; } try { var httpContent = new StringContent(JsonConvert.SerializeObject(requestData), Encoding.UTF8, "application/json"); var response = await _httpClient.PostAsync("generation", httpContent); if (!response.IsSuccessStatusCode) { throw new HttpRequestException(); } } catch { Console.WriteLine($"[{DateTime.Now}] Request containing generation data failed!"); } }