示例#1
0
        public ActionResult DeleteEventVideo(int id)
        {
            if (!_permissionService.Authorize("ManageEvents"))
            {
                return(AccessDeniedView());
            }

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

            var videoRecord = _videoService.GetEventVideoByVideoId(id);

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

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