Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="request"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public override Task <NewPassReply> NewPass(NewPassRequest request, ServerCallContext context)
        {
            var person = _mediator.Send(new NewPassQuery(request.Rut));

            if (person.Result.ERROR == TechnicalResponse.ErrorCode.None)
            {
                var channel = GrpcChannel.ForAddress(_configuration.GetSection("Mail").GetSection("url").Value);
                var client  = new Mailer.MailerClient(channel);

                var reply = client.MailChagedPassword(new MailRequest
                {
                    CuentaDestino = person.Result.CORREO_ELECTRONICO,
                    Nombre        = person.Result.NOMBRE_COMPLETO,
                    IdPersona     = person.Result.ID_PER,
                    CodEmail      = 1
                });

                var error = reply.Error; //Que se hace con el error
            }

            return(Task.FromResult(new NewPassReply
            {
                //Error = (ErrorCode)person.Result.ERROR
            }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> NewPass(int rut)
        {
            var person = await mediator.Send(new NewPassQuery(rut));

            await GrpcCallerService.CallService(_urls.GrpcMail, channel =>
            {
                var client = new Mailer.MailerClient(channel);
                client.MailChagedPassword(new MailRequest
                {
                    CuentaDestino = person.CORREO_ELECTRONICO,
                    Nombre        = person.NOMBRE_COMPLETO,
                    IdPersona     = person.ID_PER,
                    CodEmail      = 1
                });

                return(Task.CompletedTask);
            });

            return(Ok(person));
        }