Exemplo n.º 1
0
        public async Task <bool> SendRegistrationOTP(string key, [FromBody] Practice obj)
        {
            try
            {
                if (key == "73l3M3D")
                {
                    if (obj is null)
                    {
                        return(false);
                    }
                    obj.otp = GenerateOtp(obj.email);
                    var result = await _messengerService.SendRegistrationOTP(obj.name, obj.email, obj.otp, Request.Scheme + "://" + Request.Host.Value);

                    if (result == true)
                    {
                        HttpContext.Session.SetString("registrationOtp", JsonConvert.SerializeObject(obj));
                    }
                    return(result);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"file: MessengerController.cs method: SendEmail() error: {ex.Message} ");
                return(false);
            }
        }