コード例 #1
0
        public async Task <UserInviteResponseViewModel> SendInvite([FromBody] UserInviteRequestViewModel request)
        {
            if (ModelState.IsValid)
            {
                var session = await _sessionProvider.Get();

                var result = new { Success = true };
                try
                {
                    var userinvite = new UserInviteCommand()
                    {
                        UserEmail      = request.email,
                        UserInviteCode = RandomString(6)
                    };
                    await _commandSender.Send(userinvite);

                    sendEmail(userinvite);

                    return(new UserInviteResponseViewModel
                    {
                        Success = result.Success,
                    });
                }
                catch (Exception ex)
                {
                    return(new UserInviteResponseViewModel
                    {
                        Success = false
                    });
                }
            }
            else
            {
                return(new UserInviteResponseViewModel
                {
                    Success = false
                });
            }
        }
コード例 #2
0
        private void sendEmail(UserInviteCommand model)
        {
            try
            {
                string siteUrls = _siteUrlsProvider.GetSiteUrl(_siteIdProvider.GetSiteId());
                Email  email    = new Email();
                email.To           = model.UserEmail;
                email.Bcc          = "*****@*****.**";
                email.From         = "FeelitLIVE  <*****@*****.**>";
                email.TemplateName = "FeelInviteeRegistration";

                email.Variables = new Dictionary <string, object>
                {
                    ["signinlink"]   = "<a href='" + siteUrls + "/signup" + "' style='margin-right:100px; '>" + "<h3>feelitLIVE.com</h3></a>",
                    ["userpassword"] = model.UserInviteCode
                };
                _emailSender.Send(email);
            }
            catch (Exception ex)
            {
            }
        }
コード例 #3
0
        private bool sendEmail(UserInviteCommand model)
        {
            try
            {
                string siteUrls = _siteUrlsProvider.GetSiteUrl(Contracts.Enums.Site.feelaplaceSite);
                Email  email    = new Email();
                email.To           = model.UserEmail;
                email.Bcc          = "*****@*****.**";
                email.From         = "FeelitLIVE  <*****@*****.**>";
                email.TemplateName = "FeelInviteeRegistration";

                email.Variables = new Dictionary <string, object>
                {
                    ["signinlink"]   = "<a href='" + siteUrls + "/signup" + "' style='margin-right:100px; '>" + "<h3>feelitLIVE.com</h3></a>",
                    ["userpassword"] = model.UserInviteCode
                };
                _emailSender.Send(email);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }