using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TelerikMvcAppGridCustomEditorColor.Models;

namespace TelerikMvcAppGridCustomEditorColor.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var categories = GetCategories();

            ViewData["categories"] = categories;
            ViewData["defaultCategory"] = categories.First();

            return View();
        }

        public IEnumerable<CategoryViewModel> GetCategories()
        {            
            var categories = new List<CategoryViewModel>
            {
                new CategoryViewModel
                {
                    CategoryID = 1,
                    CategoryName = "Category1",
                    CategoryColor = "red"
                },
                new CategoryViewModel
                {
                    CategoryID = 2,
                    CategoryName = "Category2",
                    CategoryColor = "purple"
                },
                new CategoryViewModel
                {
                    CategoryID = 3,
                    CategoryName = "Category3",
                    CategoryColor = "blue"
                },
                new CategoryViewModel
                {
                    CategoryID = 4,
                    CategoryName = "Category4",
                    CategoryColor = "orange"
                },
                new CategoryViewModel
                {
                    CategoryID = 5,
                    CategoryName = "Category5",
                    CategoryColor = "yellow"
                }
            };

            return categories.ToList();
        }
    }
}
