Exemplo n.º 1
0
 public ImageController(
     PreviewFacade preview,
     IImageFormat[] formats,
     IUserAuthentication authentication,
     IImageRequestStrategy strategy
     )
     : base(authentication)
 {
     this.preview = preview;
     this.formats = formats;
     this.strategy = strategy;
 }
Exemplo n.º 2
0
 public AlbumController(
     IAlbumFacade gallery,
     IAuthorizationService authorization,
     IUserAuthentication authentication,
     IImageRequestStrategy requestStrategy,
     ILocation dataLocation
     )
     : base(authentication)
 {
     this.gallery = gallery;
     this.authorization = authorization;
     this.requestStrategy = requestStrategy;
     this.zipLocation = dataLocation.GetLocation("zips", ActionIfMissing.CreateNew);
 }
Exemplo n.º 3
0
        public AlbumViewModel(
            Album album,
            Func<Album, string> getAlbumID,
            IUser currentUser,
            IImageRequestStrategy imageAccess
            )
        {
            this.ID = getAlbumID(album);
            this.Album = album;
            this.VisibleToGroups = new UserGroupViewModel[0].AsReadOnly();
            this.CurrentUser = currentUser;

            var itemModels = album.Items.Value.ToLookup(item => item.IsProposedToBeDeleted);
            this.Items = itemModels[false].Select((item, index) => ToItemModel(item, index, getAlbumID, imageAccess)).ToList().AsReadOnly();
            this.ProposedToBeDeleted = itemModels[true]
                                            .GroupBy(
                                                item => item.ProposedToBeDeletedBy,
                                                item => ToItemModel(item, 1000, getAlbumID, imageAccess),
                                                (key, models) => new DeleteProposalGroupModel(key, models.ToSet())
                                            )
                                            .ToList()
                                            .AsReadOnly();
        }
Exemplo n.º 4
0
 private AlbumItemModel ToItemModel(AlbumItem item, int itemIndex, Func<Album, string> getAlbumID, IImageRequestStrategy imageAccess)
 {
     return new AlbumItemModel(
         item, itemIndex, this.ID,
         item.PrimaryAlbum.Get(getAlbumID).Value,
         request => imageAccess.GetActionUrl(request, this.ID, item.Name),
         this.CurrentUser
     );
 }