예제 #1
0
        protected virtual async Task <CloudBookListEditDto> Create(CloudBookListEditDto input, List <long> bookIds)        //
        {
            //TODO:新增前的逻辑判断,是否允许新增

            // var entity = ObjectMapper.Map <CloudBookList>(input);
            var entity   = input.MapTo <CloudBookList>();
            var entityId = await _entityRepository.InsertAndGetIdAsync(entity);

            if (bookIds.Count > 0)
            {
                await _entityManager.CreateBookListAndBookRelationship(entityId, bookIds);
            }
            return(entity.MapTo <CloudBookListEditDto>());
        }
예제 #2
0
        protected virtual async Task Update(CloudBookListEditDto input, List <long> bookIds)        //
        {
            //TODO:更新前的逻辑判断,是否允许更新

            var entity = await _entityRepository.GetAsync(input.Id.Value);

            input.MapTo(entity);

            // ObjectMapper.Map(input, entity);
            await _entityRepository.UpdateAsync(entity);

            if (bookIds.Count > 0)          //
            {
                await _entityManager.CreateBookListAndBookRelationship(entity.Id, bookIds);
            }
        }