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

namespace ChartDynamicBinding.Controllers
{
    public class HomeController : Controller
    {
        private static List<ViewModel> data = new List<ViewModel>();

        static HomeController()
        {
            data.Add(new ViewModel
            {
                Hitcount = 3,
                Date = DateTime.Parse("1/1/2011"),
                Series = "Series1"
            });

            data.Add(new ViewModel
            {
                Hitcount = 4,
                Date = DateTime.Parse("1/12/2013"),
                Series = "Series1"
            });

            data.Add(new ViewModel
            {
                Hitcount = 5,
                Date = DateTime.Parse("1/1/2011"),
                Series = "Series2"
            });

            data.Add(new ViewModel
            {
                Hitcount = 5,
                Date = DateTime.Parse("1/12/2013"),
                Series = "Series2"

            });


            data.Add(new ViewModel
            {
                Hitcount = 6,
                Date = DateTime.Parse("1/1/2011"),
                Series = "Series3"
            });

            data.Add(new ViewModel
            {
                Hitcount = 3,
                Date = DateTime.Parse("1/12/2013"),
                Series = "Series3"

            }); 
        }

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

            return View();
        }

        public ActionResult Series()
        {
            return Json(data);
        }

    }
}
