public JsonResult DashboardEmbedUrl(string accessToken, string workspaceId, string dashboardId) { try { var powerBiService = new PowerBiService(accessToken, workspaceId); if (string.IsNullOrWhiteSpace(accessToken)) { throw new Exception("Access token cannot be null"); } else if (string.IsNullOrWhiteSpace(workspaceId)) { throw new Exception("Workspace id cannot be null"); } else if (string.IsNullOrWhiteSpace(dashboardId)) { throw new Exception("Dashboard id cannot be null"); } // Generates embedUrl for dashboard else { return(this.Json(powerBiService.GetDashboardEmbedUrl(dashboardId))); } } catch (HttpRequestException ex) { Console.Error.WriteLine(ex); throw; } catch (FormatException ex) { Console.Error.WriteLine(ex); throw; } }
public JsonResult GetReport(string accessToken, string workspaceId) { try { var powerBiService = new PowerBiService(accessToken, workspaceId); if (string.IsNullOrWhiteSpace(accessToken)) { throw new Exception("Access token cannot be null"); } else if (string.IsNullOrWhiteSpace(workspaceId)) { throw new Exception("Workspace id cannot be null"); } // Retrieving reports in a workspace else { return(this.Json(powerBiService.GetReports())); } } catch (HttpRequestException ex) { Console.Error.WriteLine(ex); throw; } catch (FormatException ex) { Console.Error.WriteLine(ex); throw; } }
protected override void Initialize(HttpControllerContext controllerContext) { base.Initialize(controllerContext); _adminRepo = new AdminRepository(PowerBiAppContext, Tenant); _powerBiService = new PowerBiService(Tenant.Id, Tenant.PowerBiWorkspaceId, Tenant.ReportLocation); _powerBiPremium = new PowerBIPremium(Tenant); ReportLocation = Tenant.ReportLocation; }
public async Task <ActionResult> Index(string reportId) { if (Request.IsAuthenticated) { ReportsViewModel reportsViewModel = await PowerBiService.GetReports(reportId); return(View(reportsViewModel)); } else { return(View(new ReportsViewModel { UserIsAuthenticated = false })); } }
public EmbedInfoController(PowerBiService powerBiService) { this.m_powerBiService = powerBiService; }
public async Task <ActionResult> Index() { ReportsViewModel reportsViewModel = await PowerBiService.GetReports(""); return(View(reportsViewModel)); }