Exemplo n.º 1
0
        /// <summary>
        /// Get the media content url.
        /// </summary>
        /// <param name="fullFoldername"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public virtual IHtmlString MediaContentUrl(string fullFoldername, string fileName)
        {
            var mediaFolder = new Kooboo.CMS.Content.Models.MediaFolder(this.Site.GetRepository(), fullFoldername);

            HtmlString htmlString = new HtmlString("");

            if (string.IsNullOrEmpty(fullFoldername))
            {
                return(htmlString);
            }
            if (string.IsNullOrEmpty(fileName))
            {
                var folderPath = new FolderPath(mediaFolder);
                htmlString = new HtmlString(this.Url.Content(folderPath.VirtualPath));
            }
            else
            {
                var mediaContent = mediaFolder.CreateQuery().WhereEquals("FileName", fileName).FirstOrDefault();
                if (mediaContent != null)
                {
                    htmlString = new HtmlString(this.Url.Content(mediaContent.VirtualPath));
                }
            }

            return(htmlString);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the media content url.
        /// </summary>
        /// <param name="fullFoldername"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public virtual IHtmlString MediaContentUrl(string fullFoldername, string fileName)
        {
            var mediaFolder = new Kooboo.CMS.Content.Models.MediaFolder(this.Site.GetRepository(), fullFoldername);

            HtmlString htmlString = new HtmlString("");
            if (string.IsNullOrEmpty(fullFoldername))
            {
                return htmlString;
            }
            if (string.IsNullOrEmpty(fileName))
            {
                var folderPath = new FolderPath(mediaFolder);
                htmlString = new HtmlString(this.Url.Content(folderPath.VirtualPath));
            }
            else
            {
                var mediaContent = mediaFolder.CreateQuery().WhereEquals("FileName", fileName).FirstOrDefault();
                if (mediaContent != null)
                {
                    htmlString = new HtmlString(this.Url.Content(mediaContent.VirtualPath));
                }
            }

            return htmlString;
        }