Ejemplo n.º 1
0
        public async Task <GroupProfileDto> GetGroupProfileAsync(int id)
        {
            using (UnitOfWorkProvider.Create())
            {
                var groupProfile = await _groupProfileService.GetGroupProfileAsync(id);

                groupProfile.Posts = await GetGroupPostsAsync(id);

                foreach (var post in groupProfile.Posts)
                {
                    if (!post.StayAnonymous)
                    {
                        post.User = await _groupProfileUserService.GetAsync((int)post.UserId);

                        var comments = await _commentService.GetCommentsByPostIdAsync(post.Id);

                        foreach (var comment in comments)
                        {
                            comment.NickName = (await _basicUsersService.GetAsync(comment.UserId)).NickName;
                        }

                        post.Comments = comments;
                    }
                }

                groupProfile.GroupUsers = await _getGroupUsersService.GetGroupProfileUsersAsync(id);

                return(groupProfile);
            }
        }
Ejemplo n.º 2
0
 public async Task <IList <GroupProfileUserDto> > GetUsersByGroupIdAsync(int groupId)
 {
     using (UnitOfWorkProvider.Create())
     {
         return(await _groupUserService.GetGroupProfileUsersAsync(groupId));
     }
 }