public ActionResult ScoreStats() { try { List <ScoreBLL> Scores; List <ScoreStats> Model; using (ContextBLL ctx = new ContextBLL()) { UserBLL ThisUser = ctx.FindUserByUserName(User.Identity.Name); { if (null == ThisUser) { ViewBag.Exception = new Exception($"Count not find scores for {User.Identity.Name}"); return(View("Error")); } int TotalCount = ctx.ObtainUserScoreCount(ThisUser.UserID); Scores = ctx.GetScoresReltatedToUserID(ThisUser.UserID, 0, TotalCount); } MeaningfulCalculation mc = new MeaningfulCalculation(); Model = mc.CalculateStats(Scores); } return(View("ScoreStats", Model)); } catch (Exception ex) { ViewBag.Exception = ex; return(View("Error")); } }
public ActionResult ScoreStats() { try { List <ScoreBLL> Scores; List <ScoreStats> Model; using (ContextBLL ctx = new ContextBLL()) { int TotalCount = ctx.ObtainScoreCount(); Scores = ctx.GetScores(0, TotalCount); MeaningfulCalculation mc = new MeaningfulCalculation(); Model = mc.CalculateStats(Scores); } return(View("ScoreStats", Model)); } catch (Exception ex) { ViewBag.Exception = ex; return(View("Error")); } }