public void Save(RedefineResetPasswordDTO dto) { var result = dapper .ResetParameter() .AddParameter("@idOwner", dto.id) .AddParameter("@key", dto.key) .AddParameter("@Created", dto.Created) .Execute("redefine_password_register"); }
public BaseResponse <RedefinePasswordSolicitationDTO> Solicitation(BaseRequest <RedefinePasswordSolicitationDTO> request) { Validation(request); if (request.Success) { var type = request.Dto.CpfEmail.Value.DataType(); if (type.Equals(DATA_TYPE.CPF)) { request.Dto.CPF = request.Dto.CpfEmail.Value; } else { request.Dto.Email = request.Dto.CpfEmail.Value; } var parser = new OwnerDTOParser(); Get(new dto.filter.OwnerFilter { CPF = request.Dto.CPF, Email = request.Dto.Email }, parser); var owner = (OwnerDTO)parser.Get(); if (owner == null) { throw new Exception(); } else { var reset = new RedefineResetPasswordDTO(owner.id, Guid.NewGuid()); ownerResetPasswordDAL.Delete(new OwnerFilter { idOwner = owner.id }); ownerResetPasswordDAL.Save(reset); request.Dto.EmailOfuscated = owner.Email.Value.EmailOfuscator(); Task.Factory.StartNew(() => { resetPasswordSolicitationEmailHtml.Set(owner, reset.key); resetPasswordSolicitationEmailHtml.Create(); var emailDTO = new EmailDTO() { To = new EmailAccountDTO { Name = owner.FirstName.Value, Email = owner.Email.Value }, Subject = "[Restou da Obra] Redefinir senha", EmailHtml = resetPasswordSolicitationEmailHtml }; emailService.Send(emailDTO); }); } } return(request.CreateResponse()); }