Esempio n. 1
0
        private IFoundViewModel GetPhotoFoundViewModel(IFound found)
        {
            var photoModel = (PhotoFound)found;

            AlbumModel album     = _albumService.GetAlbum(photoModel.AlbumId);
            string     albumName = album.Name;

            UserModel user     = _userService.GetUser(photoModel.OwnerId);
            string    userName = user.FirstName + " " + user.LastName;

            string thumbnailPath = pathUtil.BuildThumbnailPath(photoModel.OwnerId, photoModel.AlbumId, photoModel.Id,
                                                               photoModel.Format, ImageSize.Medium);

            return(new PhotoFoundViewModel
            {
                ThumbnailPath = thumbnailPath,
                PhotoViewUrl = urlUtil.BuildPhotoViewUrl(photoModel.Id),
                AlbumName = albumName,
                AlbumViewUrl = urlUtil.BuildAlbumViewUrl(photoModel.AlbumId),
                UserName = userName,
                UserViewUrl = urlUtil.BuildUserViewUrl(photoModel.OwnerId),
                DateOfCreation = photoModel.DateOfCreation,
                Rating = photoModel.Rating
            });
        }
Esempio n. 2
0
        public IFoundViewModel GetViewModel(IFound found)
        {
            IFoundViewModel result = null;

            switch (found.Type)
            {
            case ItemType.Photo:

                result = GetPhotoFoundViewModel(found);
                break;

            case ItemType.User:

                result = GetUserFoundViewModel(found);
                break;

            case ItemType.Album:

                result = GetAlbumFoundViewModel(found);
                break;

            case ItemType.Comment:

                result = GetCommentFoundViewModel(found);
                break;
            }

            return(result);
        }
Esempio n. 3
0
        private IFoundViewModel GetUserFoundViewModel(IFound found)
        {
            var userFound = (UserFound)found;

            return(new UserFoundViewModel
            {
                AvatarPath = pathUtil.BuildAvatarPath(userFound.Id, ImageSize.Medium),
                Department = userFound.Department,
                IsOnline = userFound.IsOnline,
                Name = userFound.Name,
                UserViewUri = urlUtil.BuildUserViewUrl(userFound.Id)
            });
        }
Esempio n. 4
0
        private IFoundViewModel GetAlbumFoundViewModel(IFound found)
        {
            var albumFound = (AlbumFound)found;

            UserModel user     = _userService.GetUser(albumFound.OwnerId);
            string    userName = user.FirstName + " " + user.LastName;

            return(new AlbumFoundViewModel
            {
                Name = albumFound.Name,
                DateOfCreation = albumFound.DateOfCreation,
                UserViewUrl = urlUtil.BuildUserViewUrl(albumFound.OwnerId),
                AlbumViewUrl = urlUtil.BuildAlbumViewUrl(albumFound.Id),
                CollagePath = pathUtil.BuildCollagePath(albumFound.OwnerId, albumFound.Id),
                UserName = userName
            });
        }
Esempio n. 5
0
        private IFoundViewModel GetCommentFoundViewModel(IFound found)
        {
            var commentFound = (CommentFound)found;

            UserModel user     = _userService.GetUser(commentFound.OwnerId);
            string    userName = user.FirstName + " " + user.LastName;

            return(new CommentFoundViewModel
            {
                CommentUrl = urlUtil.BuildCommentUrl(commentFound.PhotoId, commentFound.Id),
                DateOfCreation = commentFound.DateOfCreation,
                UserName = userName,
                Text = commentFound.Text,
                UserViewUrl = urlUtil.BuildUserViewUrl(commentFound.OwnerId),
                UserAvatarPath = pathUtil.BuildAvatarPath(commentFound.OwnerId, ImageSize.Medium)
            });
        }