Beispiel #1
0
        public ActionResult ChangePass(IFormCollection collection)
        {
            var user = _usuarioService.GetById(Convert.ToInt32(collection["IdUsuario"]));

            if (user != null)
            {
                user.Senha = Criptography.GenerateHashString(collection["senha"]);
                if (_usuarioService.Update(user))
                {
                    _recuperarSenhaService.SetTokenInvalid(user.IdUsuario);
                    return(RedirectToActionPermanent("Index", "Login", new { msg = "sucessChange" }));
                }
            }

            return(RedirectToActionPermanent("Index", "Login", new { msg = "errorChange" }));
        }
        public ActionResult Block(string entidade, int idPessoa)
        {
            var agenteEstado = _pessoaTrabalhaEstadoService.GetByIdPessoa(idPessoa);

            var idUsuario = _usuarioService.GetByIdPessoa(idPessoa).IdUsuario;

            if (idUsuario != -1)
            {
                _recuperarSenhaService.SetTokenInvalid(idUsuario);
            }

            if (agenteEstado != null)
            {
                agenteEstado.SituacaoCadastro = "I";
                _pessoaTrabalhaEstadoService.Update(agenteEstado);
            }
            else
            {
                var agenteMunicipio = _pessoaTrabalhaMunicipioService.GetByIdPessoa(idPessoa);
                agenteMunicipio.SituacaoCadastro = "I";
                _pessoaTrabalhaMunicipioService.Update(agenteMunicipio);
            }

            int responsavel;

            if (entidade.Equals("Agente"))
            {
                responsavel = 0;
            }
            else
            {
                responsavel = 1;
            }

            TempData["responseOp"] = entidade + " bloqueado com sucesso!";

            return(RedirectToAction(nameof(IndexApproveAgent), new { ehResponsavel = responsavel }));
        }