Esempio n. 1
0
        public Resource CreateResource(CreateResourceModel model)
        {
            var entity = model.ToDest();

            PrepareCreate(entity);
            return(context.Resource.Add(entity).Entity);
        }
Esempio n. 2
0
        public async Task <Resource> CreateResourceAsync(CreateResourceModel model,
                                                         FileDestinationMetadata metadata)
        {
            var entity = model.ToDest();

            if (model.Image != null)
            {
                await SetResourceImageUrlAsync(entity, model.Image, metadata);
            }
            if (model.Logo != null)
            {
                await SetResourceImageUrlAsync(entity, model.Logo, metadata);
            }
            AddResourceCategoriesToResource(model.CategoryIds, entity);
            PrepareCreate(entity);
            return(context.Resource.Add(entity).Entity);
        }