using System;
﻿using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using TelerikMvcAppGridCustomEditorColor.Models;

namespace TelerikMvcAppGridCustomEditorColor.Controllers
{
	public partial class GridController : Controller
    {
		public ActionResult Orders_Read([DataSourceRequest]DataSourceRequest request)
		{
			var result = Enumerable.Range(1, 5).Select(i => new OrderViewModel
			{
				OrderID = i,
				Freight = i * 10,
				OrderDate = DateTime.Now.AddDays(i),
				ShipName = "ShipName " + i,
				ShipCity = "ShipCity " + i,
                CategoryID = i,
                Category = new CategoryViewModel
                {
                    CategoryID = i,
                    CategoryName = "Category" + i,
                    CategoryColor = "red"
                }
			});

			return Json(result.ToDataSourceResult(request));
		}
	}
}
