public async Task <ActionResult> AddTeamToGroupAction(FormOutput data)
 {
     return(await WithExceptionHandlingAsync(
                async token =>
     {
         await graphService.AddTeamToGroup(data.SelectedTeam, token);
         var teams = (await graphService.NewGetMyTeams(token)).ToArray();
         return new FormOutput()
         {
             Teams = teams,
             ShowTeamOutput = true
         };
     }
                ));
 }
Ejemplo n.º 2
0
        public async Task <ActionResult> AddTeamToGroup()
        {
            try
            {
                string accessToken = await AuthProvider.Instance.GetUserAccessTokenAsync();

                string groupId = Request.Form["group-id"];

                String response = await graphService.AddTeamToGroup(groupId, accessToken);

                if (response != null)
                {
                    ViewBag.CreateTeamMessage = "Successfully created/updated a team";
                }
                else
                {
                    ViewBag.CreateTeamMessage = "Fail";
                }

                return(Content(ViewBag.CreateTeamMessage));
            }
            catch (Exception e)
            {
                if (e.Message == Resource.Error_AuthChallengeNeeded)
                {
                    return(new EmptyResult());
                }
                return(RedirectToAction("Index", "Error", new { message = Resource.Error_Message + Request.RawUrl + ": " + e.Message }));
            }
        }