Ejemplo n.º 1
0
        public async Task <IActionResult> Details(string id, bool currentUser)
        {
            if (currentUser)
            {
                id = GetCurrentUserId();
            }
            var otherUserID = await _profileRepository.GetObject(id);


            await _followingRepository.LoadFollowers(otherUserID);

            if (_followingRepository.FindObject(id, GetCurrentUserID()).Result == null)
            {
                ViewData["FollowButtonText"] = "Follow";
            }
            else
            {
                ViewData["FollowButtonText"] = "Unfollow";
            }

            var currentUserObject = await _profileRepository.GetObject(GetCurrentUserID());

            var currentUserName = currentUserObject.DbRecord.Name;

            if (otherUserID.DbRecord.Name == currentUserName)
            {
                ViewData["IsCurrentPerson"] = "true";
            }
            else
            {
                ViewData["IsCurrentPerson"] = "false";
            }

            return(View(ProfileViewModelFactory.Create(otherUserID)));
        }
Ejemplo n.º 2
0
        public static EventViewModel Create(EventObject o)
        {
            var v = new EventViewModel
            {
                Name        = o?.DbRecord.Name,
                ID          = o?.DbRecord.ID,
                Location    = o?.DbRecord.Location,
                Type        = o.DbRecord.Type,
                Date        = o.DbRecord.Date,
                Description = o?.DbRecord.Description,
                Organizer   = o?.DbRecord.Organizer,
                EventImage  = o?.DbRecord.EventImage
            };

            if (o is null)
            {
                return(v);
            }
            foreach (var p in o.ProfilesInUse)
            {
                var profile = ProfileViewModelFactory.Create(p);
                v.InProfiles.Add(profile);
            }
            return(v);
        }
        public void CreateTest()
        {
            var o = GetRandom.Object <ProfileObject>();
            var v = ProfileViewModelFactory.Create(o);

            Assert.AreEqual(v.Name, o.DbRecord.Name);
            Assert.AreEqual(v.ID, o.DbRecord.ID);
            Assert.AreEqual(v.Location, o.DbRecord.Location);
            Assert.AreEqual(v.BirthDay, o.DbRecord.BirthDay);
            Assert.AreEqual(v.Occupation, o.DbRecord.Occupation);
            Assert.AreEqual(v.AboutText, o.DbRecord.AboutText);
            Assert.AreEqual(v.ProfileImage, o.DbRecord.ProfileImage);
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(string id)
        {
            var currentUser = await _profileRepository.GetObject(id);

            return(View(ProfileViewModelFactory.Create(currentUser)));
        }