Soby Web Components

This example demonstrates how to use Web API and OData in the Soby Data Grid.

  • So we will start with creating a project. Navigate to File >> New >> Project.
  • Select "ASP.NET Web Application" as shown.


  • Select "Web API" template as shown.
  • Navigate to Tools >> Library Package Manager, then select Package Manager Console. Use the following command in the Package Manager Console.
    Install-Package Microsoft.AspNet.Odata
    Install-Package EntityFramework

    These commands will install OData and EntityFramework packages
  • Create the following classes under the Models folder
    Priority.cs View code
    Category.cs View code
    Status.cs View code
    Task.cs View code
    TaskServiceContext.cs View code
  • Create the following classes under the Controllers folder
    CategoriesController.cs View code
    PrioritiesController.cs View code
    StatusesController.cs View code
    TasksController.cs View code
  • Modify the following classes under the App_Start folder
    WebApiConfig.cs View code
  • Place the following syntax into web.config
      <connectionStrings>
        <add name="TaskServiceContext" connectionString="Data Source=(localdb)\v11.0; Initial Catalog=TaskServiceContext-20160919093018; Integrated Security=True; MultipleActiveResultSets=True; AttachDbFilename=|DataDirectory|TaskServiceContext-20160919093016.mdf" providerName="System.Data.SqlClient" />
      </connectionStrings>
    
  • Navigate to Tools >> Library Package Manager, then select Package Manager Console. Use the following command in the Package Manager Console.
    Enable-Migrations

    This command will create "Migrations" folder and Configuration.cs class
  • Modify the Configuration.cs file under Migrations folder with the following code View code
  • Use the following commands in the Package Manager Console. This will create a database in the LocalDB and the add the data we have entered in the Seed method in Configuration.cs
    Add-Migration Initial
    Update-Database

  • Create the following html file under the root folder
    TaskManagement.html View code
  • Download the latest version of Sobiens Web Components. Create a folder called "media" in the root folder than copy the files into media folder you created.
  • You can now hit F5 to run and play with your Task Management web application.

Want to learn more about the grid component? Check out the API documentation.