示例#1
0
        public async Task <ActionResult <List <VideoDataset> > > GetSectionVideos([FromRoute] int cvId, [FromRoute] int sectionId, [FromRoute] int videoId)
        {
            if (await _cvService.GetCVSection(cvId, sectionId) == null)
            {
                return(NotFound());
            }
            VideoDataset result = await _videoService.GetVideoById(videoId);

            if (result != null)
            {
                return(Ok(result));
            }
            return(NotFound());
        }
示例#2
0
        public async Task <ActionResult <VideoDataset> > CreateVideo([FromRoute] int cvId, [FromRoute] int sectionId, [FromRoute] int videoId)
        {
            VideoDataset video = await _videoService.GetVideoById(videoId);

            if (video == null)
            {
                return(NotFound());
            }
            if (video.CVId != cvId || video.SectionId != sectionId)
            {
                return(Forbid());
            }
            if (await _videoService.DeleteVideo(videoId))
            {
                return(NoContent());
            }
            return(BadRequest(new { message = "Deleting video failed" }));
        }
示例#3
0
        public async Task <ActionResult <VideoDataset> > CreateVideo([FromRoute] int cvId, [FromRoute] int sectionId, [FromBody] VideoUploadParam video)
        {
            if (await _cvService.GetCVSection(cvId, sectionId) == null)
            {
                return(NotFound());
            }
            if (video.SectionId != sectionId)
            {
                return(Forbid());
            }
            VideoDataset result = await _videoService.InsertVideo(video);

            if (result != null)
            {
                return(Created("", result));
            }
            return(BadRequest(new { message = "Upload video failed" }));
        }