Exemplo n.º 1
0
        public virtual async Task <MediaDescriptorDto> CreateAsync(string entityType, CreateMediaInputWithStream inputStream)
        {
            var definition = await MediaDescriptorDefinitionStore.GetAsync(entityType);

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

            var newEntity = await MediaDescriptorManager.CreateAsync(entityType, inputStream.Name, inputStream.File.ContentType, inputStream.File.ContentLength ?? 0);

            await MediaContainer.SaveAsync(newEntity.Id.ToString(), inputStream.File.GetStream());

            await MediaDescriptorRepository.InsertAsync(newEntity);

            return(ObjectMapper.Map <MediaDescriptor, MediaDescriptorDto>(newEntity));
        }
Exemplo n.º 2
0
 public virtual Task <MediaDescriptorDto> CreateAsync(string entityType, CreateMediaInputWithStream inputStream)
 {
     return(MediaDescriptorAdminAppService.CreateAsync(entityType, inputStream));
 }