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

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

            return View();
        }
        public JsonResult GetCustomers()
        {
            var products = Enumerable.Range(1, 10).Select(i => new CustomerViewModel
            {
                CustomerID = i,
                ContactName = "Contact" + i,
                Color = i%3==0 ? "red" : "green"
            });

            return Json(products, JsonRequestBehavior.AllowGet);
        }
    }
}
