Ejemplo n.º 1
0
        public IEnumerable <VideoElement> UpdateJsonFileWithValue(VideoElement video)
        {
            if (FileProvider.Exists(_filePath))
            {
                return(UpdateFileOnTempDirectory(video));
            }
            else
            {
                var videos = new List <VideoElement> {
                    video
                };

                CreateFileOnTempDirectory(videos);

                return(videos);
            }
        }
Ejemplo n.º 2
0
        public HttpResponseMessage GetActionFile(string fileName)
        {
            var          path          = HttpRuntime.AppDomainAppPath;
            string       directoryName = System.IO.Path.Combine(path, "ActionDocuments");
            FileProvider fileProvider  = new FileProvider(directoryName);

            if (!fileProvider.Exists(fileName))
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            FileStream fileStream = fileProvider.Open(fileName);
            var        response   = new HttpResponseMessage();

            response.Content = new StreamContent(fileStream);
            response.Content.Headers.ContentDisposition
                = new ContentDispositionHeaderValue("attachment");
            response.Content.Headers.ContentDisposition.FileName = fileName;
            response.Content.Headers.ContentType
                = new MediaTypeHeaderValue("application/octet-stream");
            response.Content.Headers.ContentLength
                = fileProvider.GetLength(fileName);
            return(response);
        }