예제 #1
0
        public IActionResult Details(int?userId)
        {
            if (!userId.HasValue || userId == 0 || userService.GetUserById(userId) == null)
            {
                return(NotFoundView());
            }

            if (userId == currentUser.Id)
            {
                return(RedirectToAction("Index", "Profile", null));
            }

            var domainUser          = userService.GetUserById(userId);
            ProfileViewerModel user = mapper.Map <ProfileViewerModel>(domainUser);

            user.CanSee         = friendshipService.CanSee(userId.Value);
            user.CanSendRequest = friendshipService.CanSendRequest(userId.Value);
            user.IsRequested    = friendshipService.IsFriendRequested(userId.Value);
            user.Interests      = interestsUsersService.GetAllInterests(domainUser.Id)
                                  .Select(e => e.Name)
                                  .ToList();
            user.Album = albumService.GetAll(userId.Value).Select(e => mapper.Map <Models.DomainModels.AlbumDomainModel>(e)).ToList();

            return(View(user));
        }
예제 #2
0
        public IActionResult Index()
        {
            var domainUser = userService.GetUserById(currentUser.Id);
            var user       = mapper.Map <ProfileViewerModel>(domainUser);

            user.Interests = interestsUsersService
                             .GetAllInterests(domainUser.Id)
                             .Select(e => e.Name)
                             .ToList();
            user.Album = albumService
                         .GetAll(currentUser.Id)
                         .Select(
                e => mapper.Map <AlbumDomainModel>(e)
                ).ToList();
            return(View(user));
        }