コード例 #1
0
        public void Process(OrganizationInviteRequestServiceData data)
        {
            var request     = requestRepository.GetAsync(data.Id).Result;
            var superAdmins = userRolesRepository.Get()
                              .Include(ur => ur.User)
                              .Include(ur => ur.Role)
                              .Where(ur => ur.Role.RoleName == RoleName.SuperAdmin)
                              .ToList();

            foreach (UserRole superAdmin in superAdmins)
            {
                var locale  = superAdmin.User.LocaleOrDefault();
                var subject = translator.TranslateAsync(locale, "organizationInvites", "organizationInvites.subject", null).Result;
                var email   = new Email
                {
                    To              = superAdmin.User.Email,
                    Subject         = subject,
                    ContentTemplate = "OrganizationInviteRequest.txt",
                    ContentModel    = new
                    {
                        request.Name,
                        request.OrgAdminEmail,
                        request.WebsiteUrl,
                        BaseUrl = settings.BaseUrl
                    }
                };
                var result = emailRepository.CreateAsync(email).Result;
            }
            var result2 = requestRepository.DeleteAsync(request.Id).Result;
        }
コード例 #2
0
        public void Process(OrganizationInviteRequestServiceData data)
        {
            var request = requestRepository.GetAsync(data.Id).Result;
            var email   = new Email
            {
                // TODO: Query Users for Super Admins
                To = settings.SuperAdminEmail,
                // TODO: Get localized Subject and Template
                Subject         = "[Scriptoria] Organization Invite Request",
                ContentTemplate = "OrganizationInviteRequest",
                ContentModel    = new
                {
                    request.Name,
                    request.OrgAdminEmail,
                    request.WebsiteUrl,
                    BaseUrl = settings.BaseUrl
                }
            };
            var result = emailRepository.CreateAsync(email).Result;

            requestRepository.DeleteAsync(request.Id);
        }