public ActionResult Index(int id) { // Do a regression and populate the function data repo.FindLowestIndexReverse(repo.GetData3); // Evaluate the function at 100% of level DateTime?evaluate = repo.EvaluateFunctionAt(100.0, repo.GetData3); double fit = 0; if (evaluate != null) { fit = repo.GoodnessFit * 100; ViewBag.Prediction = "Level at 100% at " + evaluate.ToString() + " with a fit of " + fit.ToString("F2") + "%."; } else { ViewBag.Prediction = "Was not able to Evaluate the curve."; } ViewBag.LastValue = repo.GetData3[repo.GetData3.Count - 1].Value; ViewBag.LastHour = repo.GetData3[repo.GetData3.Count - 1].Category; return(View()); }