using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TelerikMvcAppDropDownList.Models;

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

            return View();
        }

        [HttpPost]
        public ActionResult Index(HomeViewModel model)
        {

            return View(model);
        }

        public ActionResult GetContractors()
        {
            var accounts = Enumerable.Range(1, 50).Select(i => new ContractorViewModel
            {
                Id = i,
                Name = "Contractor " + i
            });

            return Json(accounts, JsonRequestBehavior.AllowGet);
        }

    }
}
