Exemple #1
0
        public virtual ActionResult Regenerate(TeamDisplayModel model)
        {
            List <int> selectedIds = model.Team1.Select(p => p.Id).Union(model.Team2.Select(p => p.Id)).ToList();

            TempData["selectedIds"] = selectedIds;
            return(RedirectToAction(MVC.TeamGeneration.Display()));
        }
        public async Task <ActionResult> Statistics()
        {
            var teamDisplayModel = new TeamDisplayModel
            {
                Teams = await _teamOrchestator.GetAllTeams()
            };

            return(View(teamDisplayModel));
        }
        // GET /Teams/Display?teamId=""
        // teamId: ID of the team to display
        // Displays the details of a team, including
        // settings, channels, and installed apps
        public async Task <IActionResult> Display(string teamId)
        {
            if (string.IsNullOrEmpty(teamId))
            {
                return(RedirectToAction("List")
                       .WithError("Team ID cannot be empty."));
            }

            var model = new TeamDisplayModel();

            try
            {
                var graphClient = GetGraphClientForScopes(teamScopes);

                // GET /teams/teamId
                model.Team = await graphClient.Teams[teamId]
                             .Request()
                             .GetAsync();

                // GET /teams/teamId/channels
                var channels = await graphClient.Teams[teamId]
                               .Channels
                               .Request()
                               .GetAsync();

                model.Channels = channels.CurrentPage;

                // Querying installed apps on an archived team
                // gives an error
                if (!model.Team.IsArchived.Value)
                {
                    // GET /teams/teamId/installedApps
                    var installedApps = await graphClient.Teams[teamId]
                                        .InstalledApps
                                        .Request()
                                        // Expand the teamsAppDefinition for details
                                        .Expand("teamsAppDefinition")
                                        .GetAsync();

                    model.InstalledApps = installedApps.CurrentPage;
                }
                else
                {
                    model.InstalledApps = new List <TeamsAppInstallation>();
                }

                return(View(model));
            }
            catch (ServiceException ex)
            {
                InvokeAuthIfNeeded(ex);

                return(RedirectToAction("List")
                       .WithError($"Error getting team with ID {teamId}",
                                  ex.Error.Message));
            }
        }
Exemple #4
0
        public virtual ActionResult Display()
        {
            List <int> selectedIds = (List <int>)TempData["selectedIds"];

            if (selectedIds != null && selectedIds.Count() > 1)
            {
                TeamDisplayModel model = _teamDisplayModelBuilder.BuildModel(selectedIds);
                return(View(model));
            }
            return(RedirectToAction(MVC.TeamGeneration.Index()));
        }