public IActionResult OnGet() { string userId = userManager.GetUserId(HttpContext.User); IsSurveyNotCompleted = surveyData.CheckIfUserHaveDoneSurveyThisWeek(userId); if (IsSurveyNotCompleted) { return(RedirectToPage("./Survey")); } Teams = teamData.GetUserTeams(userId); foreach (var team in Teams) { var averages = averagesCalculate.GetSurveysAverages(team); AverageWeeks.Add(team.Name, averages); if (team.OpinionsVisible == true) { var opinions = averagesCalculate.GetOpinionsFromCurrentWeek(team, AveragesCalculate.GetCurrentWeek()); TeamsOpinions.Add(team.Name, opinions); } } return(Page()); }
public void OnGet() { if (User.IsInRole("Admin")) { Teams = teamData.GetAllTeams().Where(t => t.IsPublic == true); IEnumerable <OmadaTeam> privateTeams = teamData.GetUserTeams(userManager.GetUserId(HttpContext.User)) .Where(t => t.IsPublic == false); Teams = Teams.Concat(privateTeams); } else if (User.IsInRole("Team Leader")) { Teams = teamData.GetLeaderTeams(userManager.GetUserId(HttpContext.User)); } foreach (var team in Teams) { var averages = averagesCalculate.GetSurveysAverages(team); var opinions = averagesCalculate.GetOpinionsFromCurrentWeek(team, AveragesCalculate.GetCurrentWeek()); AverageWeeks.Add(team.Name, averages); TeamsOpinions.Add(team.Name, opinions); } }