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

namespace jQWidgetsMVCDemo.Controllers
{
	public class WidgetsController : Controller
	{
		// /Widgets/LoginFailed
		public ActionResult LoginFailed()
		{
			return View();
		}

		// /Widgets/Login
		[HttpPost]
		public ActionResult Login()
		{
			ViewData["username"] = Request.Form["username"];
			ViewData["password"] = Request.Form["password"];
			ViewData["rememberme"] = Request.Form["rememberMe"];

			if (Request.Form["username"] != "admin" || Request.Form["password"] != "admin123")
			{
				return RedirectToAction("LoginFailed");
			}

			return View();
		}

		// /Widgets/LoginForm
		public ActionResult LoginForm(string theme)
		{
			ViewData["Theme"] = theme;
			return View("LoginForm");
		}
	}
}