using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Telerik.Web.Mvc;
using TelerikMvcApplication1.ViewModels;

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

			return View();
		}

		[GridAction]
		public ActionResult GetGridData()
		{
			var list = new List<UserViewModel>();

			for (int i = 0; i < 100; i++)
			{
				list.Add(new UserViewModel { Id = i});
			}

			var pagingList = list.Skip(20).Take(5).ToList();

			return View(new GridModel { Data = pagingList, Total = list.Count});
		}
	}
}
