public static new UserListViewModel ForUserPage(string username, int Page_ID) { IInfastructureService infastructure = new InfastructureService(); IProfileService service = new ProfileService(); var allUsers = new List<User_ProfileInfo>(); var profiles = service.Profile_GetList(); foreach (var profile in profiles) { var info = new User_ProfileInfo { profile = profile, enemies = service.Profile_GetUserWhoHaveBlocked(profile.username).Count(), friendlies = service.Profile_GetUserWhoHaveFriended(profile.username).Count(), friended = service.Profile_GetFriended(profile.username).Count(), hated = service.Profile_GetBlocked(profile.username).Count() }; allUsers.Add(info); } return new UserListViewModel { allUsers = allUsers, navSection = infastructure.PageStructure_GetBySelected(Page_ID), avatars = service.Avatar_GetList(), profile = service.Profile_GetByUser(username) }; }
public static new BlockedUserListViewModel ForUserPage(string username, int Page_ID) { IInfastructureService infastructure = new InfastructureService(); IProfileService service = new ProfileService(); var _base = UserListViewModel.ForUserPage(username, Page_ID); var profiles = service.Profile_GetUserWhoHaveBlocked(username); List<User_ProfileInfo> profileInfos = new List<User_ProfileInfo>(); foreach (var profile in _base.allUsers) { if(profiles.Any(x => x.User_Profile_ID == profile.profile.User_Profile_ID)){ profileInfos.Add(profile); } } return new BlockedUserListViewModel { allUsers = profileInfos, navSection = _base.navSection, avatars = _base.avatars, profile = _base.profile }; }