public async Task <IActionResult> GetMatches() { string IdentityId = User.FindFirst(ClaimTypes.NameIdentifier).Value; User loggedInUser = _context.User.Where(u => u.IdentityUserId == IdentityId).SingleOrDefault(); var beers = await GetBeersWithCompatibleStyle(loggedInUser); var userBeersAverageAbv = await GetUserBeersAverageAbv(loggedInUser); var filteredBeers = await FilterBeers(beers, userBeersAverageAbv); foreach (Match beer in filteredBeers) { await GetBreweryInfo(beer); } var doughnutSections = await GenerateDoughnut(filteredBeers); var viewModel = new GetMatchesViewModel(); viewModel.Matches = filteredBeers; viewModel.UserTaste = _context.UserTaste.Where(u => u.UserId == loggedInUser.Id).FirstOrDefault(); viewModel.DoughnutSections = doughnutSections; return(View(viewModel)); }
public ActionResult GetMatches(int stadiumId, DateTime date) { var model = new GetMatchesViewModel() { Date = date, StadiumId = stadiumId, Matches = _matchRepo.GetMatches(date, stadiumId) }; return(View(model)); }