public void UpdateDatabase() { var predictionsWithoutDupes = PredictedComparisonDataList .GroupBy(x => x.PredictionComparisonReference).Select(x => x.First()); foreach (var prediction in predictionsWithoutDupes) { var predictionToEdit = _db.PredictionComparisons.Find(prediction.PredictionComparisonReference); if (predictionToEdit != null) { _db.PredictionComparisons.Remove(predictionToEdit); _db.PredictionComparisons.Add(prediction); } else { _db.PredictionComparisons.Add(prediction); } } _db.SaveChanges(); }
public ActionResult ResultsSeason2010_2011() { var results = new ResultsSeason2010_2011(); var orderedResults = results.GetSeasonResults(_db).ToList().OrderByDescending(x => x.FixtureDate); _db.SaveChanges(); ViewData["ResultsWithoutSpreadSuccessRate"] = new FixtureData().GetResultsWithoutSpreadsPredictionSuccessRate; return(View(orderedResults)); }