コード例 #1
0
ファイル: ImageController.cs プロジェクト: ashmind/gallery
 public ImageController(
     PreviewFacade preview,
     IImageFormat[] formats,
     IUserAuthentication authentication,
     IImageRequestStrategy strategy
     )
     : base(authentication)
 {
     this.preview = preview;
     this.formats = formats;
     this.strategy = strategy;
 }
コード例 #2
0
ファイル: AlbumController.cs プロジェクト: ashmind/gallery
 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);
 }
コード例 #3
0
ファイル: AlbumViewModel.cs プロジェクト: ashmind/gallery
        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();
        }
コード例 #4
0
ファイル: AlbumViewModel.cs プロジェクト: ashmind/gallery
 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
     );
 }