public ActionResult Create(SessionDetail sessionDetail) { if (ModelState.IsValid) { var createSession = TaskFactory<CreateSession>.Create(); createSession.SessionDetail = sessionDetail; createSession.Execute(); return Json(new { Success = true, User = sessionDetail.UserName }); } return Json(new { Success = false }); }
public ActionResult LogOn(SessionDetail model, string returnUrl) { if (ModelState.IsValid) { if (MembershipService.ValidateUser(model.UserName, model.Password)) { FormsService.SignIn(model.UserName, model.RememberMe); if (Url.IsLocalUrl(returnUrl)) { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Home"); } } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } } // If we got this far, something failed, redisplay form return View(model); }