Пример #1
0
        public async Task <MediaContent> Handle(AddMediaCommand request, CancellationToken cancellationToken)
        {
            var folder  = _repository.GetMediaDirectoryReference(request.FolderId);
            var content = await _repository.UploadContent(folder, request.Name, request.Content, request.ContentType);

            var thumbnail = _imageHelper.IsImage(request.ContentType, request.Name) ?
                            await _mediator.Send(new AddImageThumbnailCommand(content.Uri.Segments.Select(x => WebUtility.UrlDecode(x)).Last(), request.ContentType, request.Content, request.FolderId)) :
                            null;

            return(_contentConverter.ConvertContent(content, thumbnail));
        }
        private async Task <MediaContent> ConvertToMediaContent(CloudBlockBlob blob)
        {
            var thumb = await GetThumbnailIfExists(blob);

            return(_mediaContentConverter.ConvertContent(blob, thumb));
        }