Exemplo n.º 1
0
        public ActionResult InProgress()
        {
            if (AzureAuthenticationHelper.IsAuthenticated())
            {
                return(this.View());
            }

            return(this.RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult Login()
        {
            if (AzureAuthenticationHelper.IsAuthenticated())
            {
                return(this.RedirectToAction("Transfer"));
            }

            return(this.Redirect(AzureAuthenticationHelper.GetAuthString()));
        }
Exemplo n.º 3
0
        public ActionResult Tables(string datasetId)
        {
            if (AzureAuthenticationHelper.IsAuthenticated())
            {
                var helper = new PowerBiHelper(AzureAuthenticationHelper.GetSession());
                return(this.View(helper.GetTables(datasetId).Value));
            }

            return(this.RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public ActionResult Transfer()
        {
            if (AzureAuthenticationHelper.IsAuthenticated())
            {
                var helper = new PowerBiHelper(AzureAuthenticationHelper.GetSession());
                this.ViewBag.DatasetStatus = helper.IsDefaultDatasetAvailable() ? "detected" : "created";
                helper.CreateDefaultDataset();

                // helper.AddRow("6ac4bc17-a85d-4f03-bc5a-e73460568d3c", "Customers");
                return(this.View());
            }

            return(this.RedirectToAction("Index"));
        }
Exemplo n.º 5
0
        public ActionResult Index()
        {
            if (AzureAuthenticationHelper.IsAuthenticated())
            {
                return(this.RedirectToAction("Transfer"));
            }

            var values = this.Request.QueryString["code"];

            if (values != null)
            {
                string code = values;
                AuthenticationContext ac = new AuthenticationContext(PersonalConfigurationManager.AppSettings["AzureAuthorityUri"]);
                ClientCredential      cc = new ClientCredential(PersonalConfigurationManager.AppSettings["AzureClientId"], PersonalConfigurationManager.AppSettings["AzureKey"]);
                AuthenticationResult  ar = ac.AcquireTokenByAuthorizationCodeAsync(code, new Uri(PersonalConfigurationManager.AppSettings["AzureRedirectUrl"]), cc).Result;

                AzureAuthenticationHelper.SetSession(ar);
                return(this.RedirectToAction("Transfer"));
            }

            return(this.View());
        }