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

namespace KendoUIMVC5.Controllers
{
    public class HomeController : Controller
    {

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



        public ActionResult GetStudents([DataSourceRequest] DataSourceRequest request)
        {

            List<Student> result = new List<Student>();
            for (int i = 0; i < 20; i++)
            {
                result.Add(new Student { Birthday = new DateTime(1995, 1, 12), FirstName = "Gosho", LastName = "Goshov", Id = i });
                result.Add(new Student { Birthday = new DateTime(1992, 5, 15), FirstName = "Pesho", LastName = "Peshov", Id = i + 1 });
                result.Add(new Student { Birthday = new DateTime(1998, 11, 12), FirstName = "Penka", LastName = "Goshov", Id = i + 2 });
                result.Add(new Student { Birthday = new DateTime(1993, 12, 22), FirstName = "Stamat", LastName = "Stamatov", Id = i + 3 });
            }



            return Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }

        public ActionResult EditStudent(Student student)
        {
            return Json(student);
        }

        public ActionResult GetActiveATSAnnouncements([DataSourceRequest] DataSourceRequest request)
        {
            var result = new List<ATSAnnouncementViewModel>();

            for (int i = 0; i < 20; i++)
            {
                result.Add(new ATSAnnouncementViewModel { ATSAnnouncementID = i, Message = "Message" + i, StartDateTime = DateTime.Now, TargetDepartment = i });
            }

            return Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
    }
}


