using EncoderTest.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
namespace EncoderTest.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            return View();
        }


        public ActionResult GetATMStatusGrid([DataSourceRequest] DataSourceRequest request)
        {
            List<ATM> data = new List<ATM>();
            for (int i = 1; i < 100; i++)
            {
                data.Add(new ATM
                    {
                        Id = i,
                        Name = "ATM" + i % 3
                    });
            }
            return Json(data.ToDataSourceResult(request));
        }

        public ActionResult GetDetails([DataSourceRequest] DataSourceRequest request, int termId, string termName)
        {
            List<ATMDetails> data = new List<ATMDetails>();
            for (int i = termId; i < termId + 5; i++)
            {
                data.Add(new ATMDetails
                    {
                        Event = "event" + i,
                        MessageParamValue = termName + i
                    });
            }
            return Json(data.ToDataSourceResult(request));
        }

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

            return View();
        }

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

            return View();
        }
    }
}
