예제 #1
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));
        }
예제 #2
0
        public async Task <IActionResult> SendFriendRequest(string id)
        {
            Relationship relationship = new Relationship()
            {
                Requester = GetCurrentUserId(),
                Requestee = id
            };

            var doesRelationshipExist = await RelationshipRepository.CheckIfRelationshipAlreadyExists(relationship.Requester, relationship.Requestee);

            if (!doesRelationshipExist)
            {
                await RelationshipRepository.Create(relationship);
            }
            return(RedirectToAction("Profile", new { id }));
        }