Skip to content

Instantly share code, notes, and snippets.

View andiih's full-sized avatar

Andy Hawken andiih

View GitHub Profile
@andiih
andiih / StandardGrid.cs
Created October 25, 2018 14:18
Standard Grid Builder
using System;
using System.Security.Policy;
using Kendo.Mvc.UI;
using Kendo.Mvc.UI.Fluent;
using Microsoft.AspNetCore.Mvc;
namespace FiftyEggsSample.Models
{
public class StandardGrid<T> where T: class
{
@andiih
andiih / jobs.cshtml
Created October 25, 2018 14:13
A view ready for the MVC controller and StandardGridBuilder
@using System.Collections
@using FiftyEggs.Data.Models
@using Kendo.Mvc.UI
@{
var cn = (string)ViewBag.ControllerName;
var builder = new StandardGrid<Job>(cn, Url);
}
<h2>@cn</h2>
@(builder.Build(Html.Kendo().Grid<Job>(),
@andiih
andiih / Jobs.cs
Last active October 25, 2018 14:21
Grid controller with Foreign Keys
public class JobsController : KendoBaseController<Job>
{
public JobsController(SampleDbContext context) : base(context) {}
public override async Task<ActionResult> Index(int? id=null)
{
var cn = this.ControllerContext.RouteData.Values["controller"].ToString();
ViewBag.Title = cn;
ViewBag.Id = id;
ViewBag.ControllerName = cn;
@andiih
andiih / CustomersController.cs
Last active October 25, 2018 14:19
Instantiating a controller
public class CustomersController : KendoBaseController<Customer>
{
public CustomersController(SampleDbContext context) : base(context)
{
}
}
@andiih
andiih / KendoBaseController.cs
Created October 25, 2018 13:44
Kendo Grid MVC Binding Base controller class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using Microsoft.AspNetCore.Mvc;
using FiftyEggs.Data.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.EntityFrameworkCore;