Example #1
0
        public ActionResult DeleteNewsVideo(int id)
        {
            if (!_permissionService.Authorize("ManageNews"))
            {
                return(AccessDeniedView());
            }

            if (id == 0)
            {
                throw new Exception("Video id not found");
            }

            var videoRecord = _videoService.GetNewsVideoByVideoId(id);

            if (videoRecord != null)
            {
                _videoService.DeleteNewsVideo(videoRecord.Id);
            }
            else
            {
                var video = _videoService.GetVideoById(id);
                if (video != null)
                {
                    _pictureService.Delete(video.Id);
                }
            }

            SuccessNotification("News video deleted successfully");
            return(new JsonResult()
            {
                Data = true,
                ContentEncoding = Encoding.Default,
                ContentType = "application/json",
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                MaxJsonLength = int.MaxValue
            });
        }