public IActionResult EditSave(Bundle <EditViewModel> model)
        {
            VideoViewModel video   = model.PageModel.CurrentVideo;
            bool           warning = false;

            if (string.IsNullOrWhiteSpace(video.Title) || string.IsNullOrWhiteSpace(video.GroupName) || string.IsNullOrWhiteSpace(video.Description) || video.Year <= 2000)
            {
                warning = true;
            }
            else
            {
                _videoService.EditVideo(video.Id, video.Title, video.Year, video.GroupName, video.Description, User.Identity.Name, video.StateName);
            }
            return(Json(new { warning = warning }));
        }
예제 #2
0
        public IActionResult UploadDetails(Bundle <UploadViewModel> model, string selectedThumbnailId)
        {
            if (string.IsNullOrEmpty(selectedThumbnailId))
            {
                return(new JsonResult(new { ThumbnailMissing = true }));
            }

            UploadViewModel video        = model.PageModel;
            var             videoPath    = Path.Combine(_hostRootVideoPath, video.Id);
            var             thumbnailUrl = Path.Combine(videoPath, $"thumbnail{FileExtensions.Png}");

            if (selectedThumbnailId == "custom")
            {
                string   customUrl = Path.Combine(videoPath, "customthumb" + FileExtensions.Png);
                FileInfo custom    = new FileInfo(customUrl);
                custom.MoveTo(thumbnailUrl);
            }
            else
            {
                string   customUrl = Path.Combine(videoPath, "thumbnail_" + selectedThumbnailId + FileExtensions.Png);
                FileInfo thumb     = new FileInfo(customUrl);
                thumb.MoveTo(thumbnailUrl);
            }

            foreach (var file in Directory.GetFiles(videoPath))
            {
                if (Path.GetFileNameWithoutExtension(file) != "thumbnail" && Path.GetExtension(file) == FileExtensions.Png)
                {
                    RemoveFile(file);
                }
            }

            _videoService.EditVideo(model.PageModel.Id, model.PageModel.VideoTitle, model.PageModel.Year,
                                    model.PageModel.GroupName, model.PageModel.Description,
                                    User.Identity.Name, "Active");

            return(new JsonResult(""));
        }
예제 #3
0
 //修改视频
 public void EditVideo(Video video)
 {
     ivideo.EditVideo(video);
 }
예제 #4
0
파일: VideoManager.cs 프로젝트: wdy1/XueHai
 public void EditVideo(Video shi)
 {
     ivideo.EditVideo(shi);
 }