public ActionResult Register(FormCollection values)
        {
            var svc = new AccountService(new SessionManager());
            var result = svc.Register(new User() { Id = values["userid"], Username = values["username"], Password = values["password"], EmailAddress = values["email"] });

            if (result)
            {
                FormsService.SignIn(values["username"], true);
                Session["UserId"] = values["userid"];
            }            

            return Json(result, JsonRequestBehavior.AllowGet);
        }
        public ActionResult LogOn(FormCollection values)
        {
            var svc = new AccountService(new SessionManager());

            var result = svc.LogOn(values["username"], values["password"]);

            if (result.IsSuccessful)
            {
                FormsService.SignIn(values["username"], true);
                Session["UserId"] = result.UserId;
            }

            return Json(result, JsonRequestBehavior.AllowGet);
        }
 public ActionResult IsRegistrationValid(FormCollection values)
 {
     var svc = new AccountService(new SessionManager());
     return Json(svc.IsRegistrationValid(values["username"], values["password"], values["email"]), JsonRequestBehavior.AllowGet);
 }