Пример #1
0
        protected virtual async Task Update(CloludBookListEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新

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

            input.MapTo(entity);

            // ObjectMapper.Map(input, entity);
            await _entityRepository.UpdateAsync(entity);
        }
Пример #2
0
        protected virtual async Task <CloludBookListEditDto> Create(CloludBookListEditDto input)
        {
            //TODO:新增前的逻辑判断,是否允许新增

            // var entity = ObjectMapper.Map <CloludBookList>(input);
            var entity = input.MapTo <CloludBookList>();


            entity = await _entityRepository.InsertAsync(entity);

            return(entity.MapTo <CloludBookListEditDto>());
        }
        protected virtual async Task Update(CloludBookListEditDto 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);
            }
        }
        protected virtual async Task <CloludBookListEditDto> Create(CloludBookListEditDto input, List <long> bookIds)
        {
            //TODO:新增前的逻辑判断,是否允许新增

            // var entity = ObjectMapper.Map <CloludBookList>(input);
            var entity = input.MapTo <CloludBookList>();


            var entityid = await _entityRepository.InsertAndGetIdAsync(entity);

            if (bookIds.Count > 0)
            {
                await _entityManager.CreateBookListAndBookRelationship(entityid, bookIds);
            }


            //entity = await _entityRepository.InsertAsync(entity);
            return(entity.MapTo <CloludBookListEditDto>());
        }