コード例 #1
0
        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)
            };
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: j-burrows/userprofile-lib
        static void Main(string[] args)
        {
            Repository.Configuration.connString = "Server=localhost;Database=ApplicationData;Trusted_Connection=True;";

            IDataRepository<DUser_Profile> repo = RepositoryFactory.Instance.Construct<DUser_Profile>("user");
            IProfileService service = new ProfileService();
            IEnumerable<PAvatar> m = service.Avatar_Delete(new DAvatar { key = 1 });
            Console.WriteLine(m.Count());
        }
コード例 #3
0
        public static HomeIndexViewModel ForUserPage(string username, int Page_ID)
        {
            IInfastructureService infastructure = new InfastructureService();
            IProfileService service = new ProfileService();

            return new HomeIndexViewModel {
                navSection = infastructure.PageStructure_GetBySelected(Page_ID),
                avatars = service.Avatar_GetList(),
                profile = service.Profile_GetByUser(username)
            };
        }
コード例 #4
0
        public static HomeIndexViewModel ForUserPage(string username, int Page_ID)
        {
            IInfastructureService infastructure = new InfastructureService();
            IMailboxService provider = new MailboxService();
            IProfileService profiler = new ProfileService();

            return new HomeIndexViewModel {
                username = username,
                emails = provider.Email_GetByUser(username),
                blockedUsers = profiler.Blocked_User_GetByUser(username),
                friendedUsers = profiler.Friended_User_GetByUser(username),
                navSection = infastructure.PageStructure_GetBySelected(Page_ID)
            };
        }
コード例 #5
0
        public static new UsersBlockedListView 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_GetBlocked(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 UsersBlockedListView {
                allUsers = profileInfos,
                navSection = _base.navSection,
                avatars = _base.avatars,
                profile = _base.profile
            };
        }