protected virtual async Task Update(BookListEditDto 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 != null) { bookIds = bookIds.Where(o => o > 0).ToList(); await _bookListAndBookRelationshipManager.CreateRelationship(entity.Id, bookIds); } }
protected virtual async Task <BookListEditDto> Create(BookListEditDto input, List <long> bookIds) { //TODO:新增前的逻辑判断,是否允许新增 // var entity = ObjectMapper.Map <BookList>(input); var entity = input.MapTo <BookList>(); var entityId = await _entityRepository.InsertAndGetIdAsync(entity); if (bookIds != null) { bookIds = bookIds.Where(o => o > 0).ToList(); await _bookListAndBookRelationshipManager.CreateRelationship(entity.Id, bookIds); } return(entity.MapTo <BookListEditDto>()); }