//This method fills view model objects public async Task <IActionResult> CreateViewModel() { viewModel.PredictionsMonotonous = await predictionRepository.GetPredictionsByTipType("Basic", 1); viewModel.PredictionsPreviousMonotonous = await statisticsRepository.GetPredictionsPrevious(1); viewModel.TipsMonotonous = await statisticsRepository.GetTipStats(1); viewModel.LeaguesMonotonous = await statisticsRepository.GetLeagueStats(1); viewModel.PredictionsAdventurous = await predictionRepository.GetPredictionsByTipType("Basic", 2); viewModel.PredictionsPreviousAdventurous = await statisticsRepository.GetPredictionsPrevious(2); viewModel.TipsAdventurous = await statisticsRepository.GetTipStats(2); viewModel.LeaguesAdventurous = await statisticsRepository.GetLeagueStats(2); viewModel.PredictionsLudicrous = await predictionRepository.GetPredictionsByTipType("Basic", 3); viewModel.PredictionsPreviousLudicrous = await statisticsRepository.GetPredictionsPrevious(3); viewModel.TipsLudicrous = await statisticsRepository.GetTipStats(3); viewModel.LeaguesLudicrous = await statisticsRepository.GetLeagueStats(3); viewModel.TipTypeStats.Add(await statisticsRepository.GetTipTypeStats(1)); viewModel.TipTypeStats.Add(await statisticsRepository.GetTipTypeStats(2)); viewModel.TipTypeStats.Add(await statisticsRepository.GetTipTypeStats(3)); return(View("Index", viewModel)); }
// This method fills ViewModel objects with data retrieved from Repository public async Task <IActionResult> CreateViewModel(int TipTypeId) { //If User has Role linked to any paid Subscription, check if it expired if (GetUserRoleName() != "Basic" && GetUserRoleName() != "Administrator") { await accountRepository.CheckSubscriptionStatus(GetUserId(), await accountRepository.GetSubscriptionId(GetUserId())); } ViewData["TipType"] = TipTypeId; viewModel.Predictions = await predictionRepository.GetPredictionsByTipType(GetUserRoleName(), TipTypeId); randomRepository.Predictions = randomRepository.FillPredictionDictionary(await predictionRepository.GetPredictionsByTipType(GetUserRoleName(), TipTypeId)); viewModel.PredictionBoxes = randomRepository.Predictions; viewModel.PredictionsPrevious = await statisticsRepository.GetPredictionsPrevious(TipTypeId); viewModel.ControllerName = "Prediction"; viewModel.TipTypeId = TipTypeId; return(View("Index", viewModel)); }