The following tutorial shows how to use the Text Control ReportingCloud .NET Wrapper to create your first ReportingCloud application.
-
Register and create a free trial account with ReportingCloud:
-
Start Visual Studio 2015 and create a new ASP.NET Web Application. Select Empty as the Template and check MVC to add the folders and core references:
-
Open the Package Manager Console from the NuGet Package Manager menu item of the Tools main menu.
Type in the following command:
PM> Install-Package TXTextControl.ReportingCloud
-
In the Solution Explorer, right-click the Controllers folder and choose Add -> Controller from the opened context menu. In the opened dialog box, choose MVC 5 Controller - Empty and confirm with Add. Name the newly created controller HomeController and add it by clicking Add.
-
Add the following code to your controller and replace username and password with your ReportingCloud credentials:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersusing System.Collections.Generic; using System.Web.Mvc; using TXTextControl.ReportingCloud; namespace ReportingCloudTutorial.Controllers { public class HomeController : Controller { // GET: Home public ActionResult Index() { ReportingCloud rc = new ReportingCloud( "username", "password", new System.Uri("https://api.reporting.cloud")); List<Template> templates = rc.ListTemplates(); return View(templates); } } } The ListTemplates method returns a list of all templates in the template storage which is returned to the view.
-
In the Solution Explorer, right-click the newly created folder Views -> Home and choose Add -> View from the context menu. Name the view Index and confirm with Add.
-
Add the following code to the newly created view:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters@model List<TXTextControl.ReportingCloud.Template> @{ ViewBag.Title = "Index"; } <h2>All Templates</h2> <table> <tr> <th>Filename</th> <th>Modified</th> </tr> @foreach (TXTextControl.ReportingCloud.Template template in Model) { <tr> <td>@template.TemplateName</td> <td>@template.Modified</td> </tr> } </table> -
Compile and start the application. The view lists all your templates from your template storage:
More samples and unit tests can be found on GitHub: