//TODO: Move DTO Conversion and NUnit Deserialization into a separate class public void AddCollectionRun(NUnitXMLCollectionRunDTO dto) { var collectionRun = ConvertfromCollectionDTO(dto); _repo.AddCollectionRun(collectionRun); _logger.LogInformation($"{nameof(CollectionRunService)}: Collection Run SAVED at {DateTime.Now.ToLocalTime()}!"); }
public IActionResult Put([FromBody] NUnitXMLCollectionRunDTO dto) { _logger.LogInformation($"{nameof(CollectionRunController)}: Collection Run Received at {DateTime.Now.ToLocalTime()}!"); _collectionRunService.AddCollectionRun(dto); //TODO: return the realID //return CreatedAtAction("PostDeviceTestRun", new { id = 22 }); //return Created("URI TBD", dto); return(Ok("Thank you, please upload again")); }
private DeviceTestSuiteCollectionRun ConvertfromCollectionDTO(NUnitXMLCollectionRunDTO collectionRunDTO) { //var TestSelectionFilter = _mapper.Map<Models.Filter>(collectionRunDTO.TestSelectionFilter); var coll = new DeviceTestSuiteCollectionRun() { Id = collectionRunDTO.Id, Date = collectionRunDTO.Date, MobileAppBuild = collectionRunDTO.MobileAppBuild, TestSelectionQuery = collectionRunDTO.TestSelectionQuery, }; List <SingleDeviceTestSuiteRun> testRuns = new List <SingleDeviceTestSuiteRun>(); foreach (var testRunDTO in collectionRunDTO.SingleDeviceTestRuns) { var testRun = ConvertFromSingleDeviceDTO(testRunDTO, coll); testRuns.Add(testRun); } coll.SingleDeviceTestSuiteRuns = testRuns; return(coll); }