Пример #1
0
 public ActionResult Register(AccountModel model)
 {
     _accountService.AddAccount(model);
     return RedirectToAction("Index", "Home");
 }
Пример #2
0
 public JsonResult VoteFB(AccountModel account, int submissionID)
 {
     _accountService.Vote(account, submissionID);
     int voteCount = _submissionService.GetVoteCount(submissionID);
     return Json(voteCount);
 }
Пример #3
0
        public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                AccountModel accountModel = new AccountModel();
                accountModel.Email = model.Email;
                accountModel.Password = model.Password;
                accountModel.Token = model.Token;

                if (Authenticate(accountModel, model.RememberMe))
                {
                    if (Url.IsLocalUrl(returnUrl))
                    {
                        return Redirect(returnUrl);
                    }
                    else
                    {
                        return Json(new { success = true });
                    }
                }
                else
                {
                    return Json(new { success = false, message = "The email or password provided is incorrect. Please try again." });
                }
            }

            // If we got this far, something failed, redisplay form
            return RedirectToAction("Index", "Home");
        }