Ejemplo n.º 1
0
        public async Task <IActionResult> GetPopularTextFromMediaId([FromRoute] string mediaType, [FromRoute] string mediaId, [FromRoute] string name)
        {
            var result = await _textApi.GetMediaPopularTextById(mediaId);

            var vm = new MediaResultViewModel {
                MediaId = mediaId, MediaTextResult = result, MediaName = name
            };

            return(View("PopularText", vm));
        }
Ejemplo n.º 2
0
        public ActionResult Media()
        {
            if (Request.Files.Count == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var model = new MediaResultViewModel();

            foreach (string fileName in Request.Files)
            {
                HttpPostedFileBase file = Request.Files[fileName];
                var media = _mediaLibraryService.ImportMedia(file.InputStream, GetMediaPath(), file.FileName);
                _orchardServices.ContentManager.Create(media);

                model.files.Add(new {
                    url = _mediaLibraryService.GetMediaPublicUrl(media.FolderPath, media.FileName)
                });
            }

            return(Json(model));
        }