public async Task <IActionResult> LoadStringAndAnalyze([FromBody] StringSourceViewModel stringSourceViewModel) { try { var memorySource = await _stringSourceLoader.LoadData(stringSourceViewModel); var metrics = _metricsCreator.CreateMetrics(memorySource); return(new JsonResult(new { success = true, metrics }, new JsonSerializerSettings() { Converters = new List <JsonConverter>() { new StringEnumConverter() } })); } catch (Exception ex) { return(new JsonResult(new { success = false, exception = ex.ToString() })); } }
public async Task <IActionResult> LoadFromString([FromBody] StringSourceViewModel source) { try { var memorySource = await _stringSourceLoader.LoadData(source); await _fileProjectWorker.SaveProject(memorySource, source.Project); return(new JsonResult(new { success = true })); } catch (Exception ex) { return(new JsonResult(new { success = false, exception = ex.ToString() })); } }