예제 #1
0
        public ActionResult Index(ResetPasswordModel model)
        {
            if (String.IsNullOrEmpty(model.EmailAddress))
            {
                ViewBag.ErrorMessage = "Please enter an email address";
                return(View());
            }

            return(DatabaseFunction <ActionResult>(conn =>
            {
                Invite[] invites = Invite.GetInvites(conn);

                Invite loggedInInvite = invites.SingleOrDefault(p => p.EmailAddress.ToLower() == model.EmailAddress.Trim().ToLower());

                if (loggedInInvite == null)
                {
                    ViewBag.ErrorMessage = "Email address not found";
                    return View();
                }

                loggedInInvite.ResetPassword();
                loggedInInvite.Save(conn);

                SendInviteEmail(loggedInInvite);

                return RedirectToAction("Index", "LogIn");
            }));
        }
        public ActionResult Index(Int32 inviteId)
        {
            return(View(DatabaseFunction <Invite>(conn =>
            {
                Invite invite = new Invite(conn, inviteId);
                invite.EmailMessages = false;
                invite.Save(conn);

                return invite;
            })));
        }