using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Telerik.Web.Mvc;
using TelerikGridEditSample.Models;

namespace TelerikGridEditSample.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";

            return View();
        }

        [GridAction]
        public ActionResult Select()
        {
            List<SampleModel> dataSet = new List<SampleModel>
                                            {
                                                new SampleModel { SampleId = 1, DateCreated = DateTime.Now, DocumentPath = "/test.html", Name = "Sample 1"},
                                                new SampleModel { SampleId = 2, DateCreated = DateTime.Now, DocumentPath = "/test.html", Name = "Sample 2"},
                                                new SampleModel { SampleId = 3, DateCreated = DateTime.Now, DocumentPath = "/test.html", Name = "Sample 3"},
                                                new SampleModel { SampleId = 4, DateCreated = DateTime.Now, DocumentPath = "/test.html", Name = "Sample 4"},
                                                new SampleModel { SampleId = 5, DateCreated = DateTime.Now, DocumentPath = "/test.html", Name = "Sample 5"},
                                                new SampleModel { SampleId = 6, DateCreated = DateTime.Now, DocumentPath = "/test.html", Name = "Sample 6"},
                                            };

            return new JsonResult { Data = new GridModel(dataSet) };
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
