コード例 #1
0
        public async Task <IActionResult> Index(int Id)
        {
            var artwork             = ArtRepository.GetArtworkForUser(Id);
            var allArtworksFromUser = await ArtRepository.GetPostedArtFromUniqueUser(artwork.Member);

            artworkDetailViewModel = new ArtworkDetailViewModel(allArtworksFromUser, artwork, artwork.Member);
            return(View(artworkDetailViewModel));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(string Id)
        {
            Image  image  = ImageRepository.GetImageFromDb(Id);
            Member member = await MemberRepository.GetMember(Id);

            IEnumerable <Artwork> artwork = await ArtRepository.GetPostedArtFromUniqueUser(member);

            ProfileViewModel = new ProfileViewModel(artwork, member, image);
            return(View(ProfileViewModel));
        }
コード例 #3
0
        public async Task <IActionResult> Index(string Id)
        {
            var acceptedFriendsRelationships = await RelationshipRepository.GetRelationshipsByUserId(Id);

            var pendingFriendsRelationships = await RelationshipRepository.GetPendingRelationship(Id);

            Image  image  = ImageRepository.GetImageFromDb(Id);
            Member member = await MemberRepository.GetMember(Id);

            IEnumerable <Artwork> artwork = await ArtRepository.GetPostedArtFromUniqueUser(member);


            var pendingFriends = new List <Member>();

            foreach (var pending in pendingFriendsRelationships)
            {
                Member friendMember = await MemberRepository.GetMember(pending.Requester);

                Image profilePicture = ImageRepository.GetImageFromDb(pending.Requester);
                if (profilePicture != null)
                {
                    friendMember.ProfilePicture = profilePicture.ImageName;
                }
                pendingFriends.Add(friendMember);
            }

            var acceptedFriends = new List <Member>();

            foreach (var friend in acceptedFriendsRelationships)
            {
                if (friend.Requester == Id)
                {
                    Member AcceptedFriend = await MemberRepository.GetMember(friend.Requestee);

                    Image profilePicture = ImageRepository.GetImageFromDb(AcceptedFriend.MemberId);
                    if (profilePicture != null)
                    {
                        AcceptedFriend.ProfilePicture = profilePicture.ImageName;
                    }
                    acceptedFriends.Add(AcceptedFriend);
                }
                else
                {
                    Member AcceptedFriend = await MemberRepository.GetMember(friend.Requester);

                    Image profilePicture = ImageRepository.GetImageFromDb(AcceptedFriend.MemberId);
                    AcceptedFriend.ProfilePicture = profilePicture.ImageName;
                    acceptedFriends.Add(AcceptedFriend);
                }
            }
            ProfileViewModel = new ProfileViewModel(artwork, member, image, acceptedFriends, pendingFriends);

            return(View(ProfileViewModel));
        }
コード例 #4
0
        public async Task <IActionResult> Profile(string Id)
        {
            var    currentUserId = GetCurrentUserId();
            Image  image         = ImageRepository.GetImageFromDb(Id);
            Member member        = await MemberRepository.GetMember(Id);

            IEnumerable <Artwork> artwork = await ArtRepository.GetPostedArtFromUniqueUser(member);

            var doesRelationshipExist = await RelationshipRepository.CheckIfRelationshipAlreadyExists(currentUserId, Id);


            ProfileViewModel = new ProfileViewModel(artwork, member, image, doesRelationshipExist, currentUserId);
            return(View(ProfileViewModel));
        }