public async Task <bool> SendTopicReplyEmailNotificationAsync(int topicId, string currentUserId, string url)
        {
            try
            {
                var topic = await _manageForumTopics.GetForumTopicAsync(topicId);

                var currentUser = await _manageUsers.GetUserAsync(currentUserId);

                var topicSubscriptions = await _manageTopicSubscriptions.GetSubscriptionsForTopicAsync(topicId);

                foreach (var subscription in topicSubscriptions.Where(p => p.Id != currentUser.Id).ToList())
                {
                    var user = await _manageUsers.GetUserAsync(subscription.Id);

                    await _emailSender.SendEmailAsync(user.Email, "RE: " + topic.Title, currentUser.UserName + " has posted a reply to a topic that you're subscribed to at: <a href=\"" + url + "\">" + url + "</a>.");
                }

                return(true);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "There was a problem emailing the topic reply notification(s)");

                return(false);
            }
        }
示例#2
0
        public async Task <ObjectResult> GetCurrentUser()
        {
            var userFromClaims = GetIdentityFromClaims();
            var result         = await _userService.GetUserAsync(userFromClaims.Id);

            return(new OkObjectResult(result));
        }
示例#3
0
        public async Task AddUserToTopicAsync(List <ForumTopic> topics)
        {
            foreach (var topic in topics)
            {
                var user = await _userManager.GetUserAsync(topic.UserId);

                topic.UserName = user.UserName;
            }
        }
示例#4
0
        private async Task LoadAsync(ApplicationUser user)
        {
            var appUser = await _manageUsers.GetUserAsync(user.Id);

            Username = appUser.UserName;

            Input = new ProfileInputModel
            {
                DisplayName = appUser.DisplayName,
                Title       = appUser.Title,
                Location    = appUser.Location,
                About       = appUser.About,
                PhoneNumber = appUser.PhoneNumber,
                GitHub      = appUser.GitHub,
                Twitter     = appUser.Twitter,
                LinkedIn    = appUser.LinkedIn,
                Website     = appUser.Website
            };
        }