Пример #1
0
        protected virtual async Task <BookEditDto> Create(BookEditDto input, ICollection <long> tagIds)
        {
            //TODO:新增前的逻辑判断,是否允许新增

            var entity = ObjectMapper.Map <Book>(input);

            //调用领域服务
            entity = await _bookManager.CreateAsync(entity);

            if (tagIds.Count > 0)
            {
                await _bookManager.CreateBookAndBookTag(entity.Id, tagIds);
            }
            var dto = ObjectMapper.Map <BookEditDto>(entity);

            return(dto);
        }