public ActionResult InProgress()
        {
            if (AzureAuthenticationHelper.IsAuthenticated())
            {
                return(this.View());
            }

            return(this.RedirectToAction("Index"));
        }
        public ActionResult Login()
        {
            if (AzureAuthenticationHelper.IsAuthenticated())
            {
                return(this.RedirectToAction("Transfer"));
            }

            return(this.Redirect(AzureAuthenticationHelper.GetAuthString()));
        }
        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"));
        }
        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"));
        }
        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());
        }