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

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

            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        public ActionResult Read([DataSourceRequest] DataSourceRequest  request)
        {
            return Json(GetPOData().ToDataSourceResult(request));
        }

        public ActionResult ReadLines([DataSourceRequest] DataSourceRequest  request)
        {
            return Json(GetPOData().ToDataSourceResult(request));
        }
         
        public IEnumerable<POLines> GetPOLinesData()
        {
            return Enumerable.Range(0, 10).Select(i => new POLines());
        }

        public IEnumerable<PO> GetPOData()
        {
            return Enumerable.Range(0, 10).Select(i => new PO());
        }
    }
}
