using Newtonsoft.Json;
using System;
using System.Web.Mvc;

namespace jQueryForm.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        public JsonResult Login(string name, string pwd)
        {
            var jr = new JsonResult();
            if (string.Equals(name, "Ni", StringComparison.InvariantCultureIgnoreCase) && string.Equals(pwd, "123"))
            {
                jr.Data = JsonConvert.SerializeObject(true);
            }
            else
                jr.Data = JsonConvert.SerializeObject(false);
            return jr;

        }
    }
}
