├── Views
├── _ViewStart.cshtml
├── Shared
│ ├── Error.cshtml
│ └── _Layout.cshtml
├── Home
│ └── Index.cshtml
└── Web.config
├── README.md
├── Scripts
├── _references.js
└── jquery-1.8.2.min.js
├── Global.asax
├── App_Start
├── FilterConfig.cs
├── BundleConfig.cs
├── RouteConfig.cs
└── WebApiConfig.cs
├── Controllers
├── HomeController.cs
└── DataController.cs
├── Models
├── Country.cs
├── ClientFilter.cs
└── Client.cs
├── Content
└── Site.css
├── DAL
├── DataContext.cs
└── DataInitializer.cs
├── Global.asax.cs
├── Web.Debug.config
├── Web.Release.config
├── Properties
└── AssemblyInfo.cs
├── packages.config
├── .gitignore
├── Web.config
└── JSGridWebAPISample.csproj
/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "~/Views/Shared/_Layout.cshtml";
3 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # jsgrid-webapi
2 | Sample project for jsgrid with WebAPI remote source
3 |
--------------------------------------------------------------------------------
/Scripts/_references.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tabalinas/jsgrid-webapi/HEAD/Scripts/_references.js
--------------------------------------------------------------------------------
/Global.asax:
--------------------------------------------------------------------------------
1 | <%@ Application Codebehind="Global.asax.cs" Inherits="JSGridWebAPISample.WebApiApplication" Language="C#" %>
2 |
--------------------------------------------------------------------------------
/App_Start/FilterConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Web;
2 | using System.Web.Mvc;
3 |
4 | namespace JSGridWebAPISample {
5 |
6 | public class FilterConfig {
7 |
8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
9 | filters.Add(new HandleErrorAttribute());
10 | }
11 |
12 | }
13 |
14 | }
--------------------------------------------------------------------------------
/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = null;
3 | }
4 |
5 |
6 |
7 |
8 |
9 | Error
10 |
11 |
12 |
13 | Error.
14 | An error occurred while processing your request.
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Mvc;
6 |
7 | namespace JSGridWebAPISample.Controllers {
8 |
9 | public class HomeController: Controller {
10 |
11 | public ActionResult Index() {
12 | return View();
13 | }
14 |
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/Models/Country.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace JSGridWebAPISample.Models {
7 |
8 | public enum Country {
9 | UnitedStates = 1,
10 | Canada = 2,
11 | UnitedKingdom = 3,
12 | France = 4,
13 | Brazil = 5,
14 | China = 6,
15 | Russia = 7
16 | }
17 |
18 | }
--------------------------------------------------------------------------------
/Models/ClientFilter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace JSGridWebAPISample.Models {
7 |
8 | public class ClientFilter {
9 |
10 | public string Name { get; set; }
11 | public string Address { get; set; }
12 | public Country? Country { get; set; }
13 | public bool? Married { get; set; }
14 |
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/Models/Client.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace JSGridWebAPISample.Models {
7 |
8 | public class Client {
9 |
10 | public int ID { get; set; }
11 | public string Name { get; set; }
12 | public int Age { get; set; }
13 | public Country? Country { get; set; }
14 | public string Address { get; set; }
15 | public bool Married { get; set; }
16 |
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/App_Start/BundleConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Web;
2 | using System.Web.Optimization;
3 |
4 | namespace JSGridWebAPISample {
5 |
6 | public class BundleConfig {
7 |
8 | public static void RegisterBundles(BundleCollection bundles) {
9 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
10 | "~/Scripts/jquery-{version}.js"));
11 |
12 | bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
13 | }
14 |
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewBag.Title
7 | @Styles.Render("~/Content/css")
8 | @RenderSection("head", required : false)
9 |
10 |
11 |
12 | JSGrid and WebAPI Sample
13 |
14 | @RenderBody()
15 |
16 | @Scripts.Render("~/bundles/jquery")
17 | @RenderSection("scripts", required: false)
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Content/Site.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | padding: 0;
4 | box-sizing: border-box;
5 | }
6 |
7 | html {
8 | height: 100%;
9 | }
10 |
11 | body {
12 | height: 100%;
13 | padding: 10px;
14 | color: #262626;
15 | font-family: 'Helvetica Neue Light', 'Helvetica Neue', 'Segoe UI', Roboto, sans-serif, Arial;
16 | font-size: 14px;
17 | font-weight: 300;
18 | }
19 |
20 | h1 {
21 | margin: 0 0 8px 0;
22 | font-size: 24px;
23 | font-family: 'Helvetica Neue Light', 'Helvetica Neue', 'Segoe UI', Roboto, sans-serif, Arial;
24 | font-weight: 300;
25 | }
--------------------------------------------------------------------------------
/DAL/DataContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Data.Entity;
4 | using System.Data.Entity.ModelConfiguration.Conventions;
5 | using System.Linq;
6 | using System.Web;
7 | using JSGridWebAPISample.Models;
8 |
9 | namespace JSGridWebAPISample.DAL {
10 |
11 | public class DataContext: DbContext {
12 |
13 | public DbSet Client { get; set; }
14 |
15 | protected override void OnModelCreating(DbModelBuilder modelBuilder) {
16 | base.OnModelCreating(modelBuilder);
17 | modelBuilder.Conventions.Remove();
18 | }
19 | }
20 |
21 | }
--------------------------------------------------------------------------------
/App_Start/RouteConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Mvc;
6 | using System.Web.Routing;
7 |
8 | namespace JSGridWebAPISample {
9 |
10 | public class RouteConfig {
11 |
12 | public static void RegisterRoutes(RouteCollection routes) {
13 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
14 |
15 | routes.MapRoute(
16 | name : "Default",
17 | url : "{controller}/{action}/{id}",
18 | defaults : new { controller = "Home", action = "Index", id = UrlParameter.Optional }
19 | );
20 | }
21 |
22 | }
23 |
24 | }
--------------------------------------------------------------------------------
/Global.asax.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Http;
6 | using System.Web.Mvc;
7 | using System.Web.Optimization;
8 | using System.Web.Routing;
9 |
10 | namespace JSGridWebAPISample {
11 | // Note: For instructions on enabling IIS6 or IIS7 classic mode,
12 | // visit http://go.microsoft.com/?LinkId=9394801
13 |
14 | public class WebApiApplication: System.Web.HttpApplication {
15 | protected void Application_Start() {
16 | AreaRegistration.RegisterAllAreas();
17 |
18 | WebApiConfig.Register(GlobalConfiguration.Configuration);
19 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
20 | RouteConfig.RegisterRoutes(RouteTable.Routes);
21 | BundleConfig.RegisterBundles(BundleTable.Bundles);
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/App_Start/WebApiConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web.Http;
5 |
6 | namespace JSGridWebAPISample {
7 |
8 | public static class WebApiConfig {
9 |
10 | public static void Register(HttpConfiguration config) {
11 | config.Routes.MapHttpRoute(
12 | name : "DefaultApi",
13 | routeTemplate : "api/{controller}/{id}",
14 | defaults : new { id = RouteParameter.Optional }
15 | );
16 |
17 | // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable return type.
18 | // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries.
19 | // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712.
20 | //config.EnableQuerySupport();
21 |
22 | // To disable tracing in your application, please comment out or remove the following line of code
23 | // For more information, refer to: http://www.asp.net/web-api
24 | config.EnableSystemDiagnosticsTracing();
25 | }
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
--------------------------------------------------------------------------------
/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("JSGridWebAPISample")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("JSGridWebAPISample")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("991ca5b8-61fe-4313-aef7-478041f72977")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Controllers/DataController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.Specialized;
4 | using System.Linq;
5 | using System.Net;
6 | using System.Net.Http;
7 | using System.Web;
8 | using System.Web.Http;
9 | using JSGridWebAPISample.DAL;
10 | using JSGridWebAPISample.Models;
11 |
12 | namespace JSGridWebAPISample.Controllers {
13 |
14 | public class DataController: ApiController {
15 |
16 | DataContext _db = new DataContext();
17 |
18 | DataContext DB {
19 | get { return _db; }
20 | }
21 |
22 | public IEnumerable