예제 #1
0
        public async Task <int> UploadVideo(UploadingVideoDto videoDto)
        {
            var video = _mapper.Map <Video>(videoDto);

            try
            {
                video.VideoPath = await SaveVideoFile(videoDto.VideoFile);

                video.ImagePreviewPath = await SaveImagePreview(videoDto.ImagePreview);

                var createdVideoId = await _videosRepository.AddVideo(video);

                return(createdVideoId);
            }
            catch (Exception ex)
            {
                CleanupFiles(video);
                throw;
            }
        }
        public async Task <int> UploadVideo([FromForm] UploadingVideoDto video)
        {
            var createdVideoId = await _videosService.UploadVideo(video);

            return(createdVideoId);
        }