using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TelerikTest.Models;
using TelerikTest.Services;
using Telerik.Web.Mvc;

namespace TelerikTest.Controllers
{
    public class HomeController : Controller
    {
        private IRequestListService _requestListService;
        public HomeController() : this(new RequestListService()) { }
        public HomeController(RequestListService requestListService)
        {
            this._requestListService = requestListService;
        }

        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";

            return View();
        }

        public ActionResult ViewRequest()
        {
            ListRequestVM listRequestVM = new ListRequestVM();
            listRequestVM = _requestListService.GetAllForms();
            return View("ViewRequest", listRequestVM);
        }

        [GridAction]
        public ActionResult _ViewRequest()
        {
            ListRequestVM listRequestVM = new ListRequestVM();
            listRequestVM = _requestListService.GetAllForms();
            return View("ViewRequest", listRequestVM);
        }

    }
}
