示例#1
0
    public virtual async Task <RemoteStreamContent> DownloadAsync(Guid id)
    {
        var entity = await MediaDescriptorRepository.GetAsync(id);

        var stream = await MediaContainer.GetAsync(id.ToString());

        return(new RemoteStreamContent(stream, entity.Name, entity.MimeType));
    }
示例#2
0
        public virtual async Task DeleteAsync(Guid id)
        {
            var mediaDescriptor = await MediaDescriptorRepository.GetAsync(id);

            var definition = await MediaDescriptorDefinitionStore.GetDefinitionAsync(mediaDescriptor.EntityType);

            await CheckAnyOfPoliciesAsync(definition.DeletePolicies);

            await MediaContainer.DeleteAsync(id.ToString());

            await MediaDescriptorRepository.DeleteAsync(id);
        }
示例#3
0
        public virtual async Task DeleteAsync(Guid id)
        {
            var mediaDescriptor = await MediaDescriptorRepository.GetAsync(id);

            var definition = await MediaDescriptorDefinitionStore.GetAsync(mediaDescriptor.EntityType);

            /* TODO: Shouldn't DeletePolicies be a dictionary and we check for inputStream.EntityType? */
            await CheckAnyOfPoliciesAsync(definition.DeletePolicies);

            await MediaContainer.DeleteAsync(id.ToString());

            await MediaDescriptorRepository.DeleteAsync(id);
        }