コード例 #1
0
        public async Task <IActionResult> PreRegister([FromBody] PreRegisterDAO pre)
        {
            try
            {
                var response = await _registerRepository.FirstRegister(pre);

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var html = await _viewRenderService.RenderToStringAsync("Register/Emailtemplate", response.Value);

                    await _emailService.SendEmailAsync(pre.Email, html, "Email Verification");

                    return(Ok(new Response {
                        Status = "OK", Message = "Se ha enviado un correo electrónico favor de verificar para poder contitnuar con el registro "
                    }));
                }
                else
                {
                    return(StatusCode((int)response.StatusCode, new Response {
                        Status = "Error", Message = response.Message
                    }));
                }
            }
            catch (Exception e)
            {
                SystemLog systemLog = new SystemLog
                {
                    Description = e.ToMessageAndCompleteStacktrace(),
                    DateLog     = DateTime.UtcNow.ToLocalTime(),
                    Controller  = GetType().Name,
                    Action      = UtilitiesAIO.GetCallerMemberName(),
                    Parameter   = JsonConvert.SerializeObject(pre)
                };
                _customSystemLog.AddLog(systemLog);
                return(StatusCode(500, new Response {
                    Status = "Error", Message = systemLog.Description
                }));
            }
        }