GetFileById() public method

Get an media file by its Id
public GetFileById ( int fileId ) : WikiFile
fileId int
return OurUmbraco.Wiki.BusinessLogic.WikiFile
コード例 #1
0
ファイル: Files.ascx.cs プロジェクト: larrynPL/OurUmbraco
        protected void ArchiveFile(object sender, CommandEventArgs e)
        {
            var mediaProvider = new MediaProvider();
            var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString()));

            if (e.CommandName == "Unarchive")
            {
                f.Archived = false;
            }
            else
            {
                f.Archived = true;
            }

            mediaProvider.SaveOrUpdate(f);
            RebindFiles();
        }
コード例 #2
0
        protected void DeleteFile(object sender, CommandEventArgs e)
        {
            var mediaProvider = new MediaProvider();
            var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString()));
            _defaultFile = string.Empty;

            //update the project
            var nodeListingProvider = new NodeListingProvider();
            IListingItem project = nodeListingProvider.GetListing((int)ProjectId);
            project.DefaultScreenshot = _defaultFile;
            nodeListingProvider.SaveOrUpdate(project);

            var mem = Member.GetCurrentMember();

            if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId))
                mediaProvider.Remove(f);

            RebindFiles();
        }
コード例 #3
0
ファイル: Files.ascx.cs プロジェクト: larrynPL/OurUmbraco
        protected void DeleteFile(object sender, CommandEventArgs e)
        {
            var mediaProvider = new MediaProvider();
            var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString()));

            var mem = Member.GetCurrentMember();

            if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId))

            //if the file is the default file we need to clear it out of the system to stop it showing as the default download
            if (f.Id.ToString() == _defaultFile)
            {
                _defaultFile = string.Empty;
                var nodeListingProvider = new NodeListingProvider();
                var project = nodeListingProvider.GetListing((int)ProjectId);
                project.CurrentReleaseFile = _defaultFile;
                nodeListingProvider.SaveOrUpdate(project);

            }

            mediaProvider.Remove(f);

            RebindFiles();
        }