示例#1
0
        // GET: Media
        public ActionResult Card(string id)
        {
            //Create the service
            var mediaService = new MediaRetrievalService(mediaSourceUrl, mediaPath);
            //Get the localbaseDirectory (using the current HTTP Context)
            var localBaseDirectory = mediaService.createDirectory();
            //Create the path to the file
            var localFile = mediaService.getFile(namingFormat, id, localBaseDirectory);

            //Download the file if not exists on the local directory
            mediaService.DownloadFromSource(id, localFile);
            //Return the file to the view
            return(File(localFile, "image/png"));
        }
示例#2
0
        public void ShouldCreateACorrectUrlWithNumericId()
        {
            var result = mediaService.getFile(namingFormat, id, localBaseDirectory);

            result.ShouldEqual("C:/ProgramFiles/App_Data/media/1.png");
        }