public ActionResult ChangePassword(UsuarioModels model)
        {
            if (ModelState.IsValid)
            {

                // ChangePassword will throw an exception rather
                // than return false in certain failure scenarios.
                bool changePasswordSucceeded;
                try
                {
                    MembershipUser currentUser = Membership.GetUser(User.Identity.Name, true /* userIsOnline */);
                    changePasswordSucceeded = currentUser.ChangePassword(model.Senha, model.Senha);
                }
                catch (Exception)
                {
                    changePasswordSucceeded = false;
                }

                if (changePasswordSucceeded)
                {
                    return RedirectToAction("ChangePasswordSuccess");
                }
                else
                {
                    ModelState.AddModelError("", "The current password is incorrect or the new password is invalid.");
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        public ActionResult Index(UsuarioModels usuario)
        {
            var usuLogin = ConfigurationManager.AppSettings["Login"].ToString();
            var usuSenha = ConfigurationManager.AppSettings["Senha"].ToString();
            if (Request.Form["login"].Equals(usuLogin) && Request.Form["senha"].Equals(usuSenha))
            {
                FormsAuthentication.SetAuthCookie("Administrador", true);
                return RedirectToAction("Index","Home");
            }
            else
            {
                ModelState.AddModelError("", "Usuário ou senha incorretos.");
            }

            return View("LogOn");
        }
 public ActionResult LogOn(UsuarioModels model)
 {
     return View();
 }
        public ActionResult Register(UsuarioModels model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.Login, model.Senha, model.Email, null, null, true, null, out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    FormsAuthentication.SetAuthCookie(model.Login, false /* createPersistentCookie */);
                    return RedirectToAction("Index", "Girls");
                }
                else
                {
                    return RedirectToAction("Index", "Girls");
                    //ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }