/// <summary>
 /// Initializes a new instance of the UserProfileView class.
 /// </summary>
 public UserProfileView(string userHandle, string firstName, string lastName, string bio, string photoHandle, string photoUrl, Visibility visibility, long totalTopics, long totalFollowers, long totalFollowing, FollowerStatus followerStatus, FollowingStatus followingStatus, ProfileStatus profileStatus)
 {
     UserHandle      = userHandle;
     FirstName       = firstName;
     LastName        = lastName;
     Bio             = bio;
     PhotoHandle     = photoHandle;
     PhotoUrl        = photoUrl;
     Visibility      = visibility;
     TotalTopics     = totalTopics;
     TotalFollowers  = totalFollowers;
     TotalFollowing  = totalFollowing;
     FollowerStatus  = followerStatus;
     FollowingStatus = followingStatus;
     ProfileStatus   = profileStatus;
 }
Beispiel #2
0
        public async Task <Response <List <UserShortInfo> > > Get(string userId, FollowingStatus status)
        {
            var responce = new Response <List <UserShortInfo> >();

            var followersIds = await _context.Comunities.Where(x => x.FollowingToId == userId && x.Status == status)
                               .Select(x => x.FollowingFromId).ToListAsync();

            if (followersIds?.Any() != true)
            {
                responce.Error = new Error("followers can`t be founded by user id");
                return(responce);
            }

            var users = await _context.Users.Include(x => x.UserInfo)
                        .Where(q => followersIds.Contains(q.Id))
                        .Select(x => new UserShortInfo(x))
                        .ToListAsync();

            responce.Data = users;
            return(responce);
        }