public async Task <GtMetrics> MakeGtMetric() { if (_gtMetricsServices.GetAll().Count() > 0) { return(null); } GtMetrics initial = await _gtMetricsServices.Test("kubotausa.com", 1); return(initial); }
public async Task <IActionResult> Post(GtMetricsToApi metric) { try { GtMetrics results = await Task.Run(() => { return(_gtService.Test(metric.Url, metric.CompanyId)); }); if (results == null) { return(NotFound(results.Error)); } var AddMetric = _gtService.Add(results); return(Ok(results.Id)); } catch (Exception ex) { ModelState.AddModelError("PostURL", ex.Message); ModelState.AddModelError("PostURLStackTrace", ex.StackTrace); return(BadRequest(ModelState)); } }