public void Create(CreateFileRelationsInput input) { foreach (var item in input.Files) { var entity = new AbpFileRelation() { Id = Guid.NewGuid(), BusinessId = input.BusinessId, BusinessType = input.BusinessType, FileId = item.Id, Sort = item.Sort }; _abpFileRelationRepository.Insert(entity); } }
public async Task CreateAsync(CreateFileRelationsInput input) { if (input.Files == null) { return; } foreach (var item in input.Files) { var entity = new AbpFileRelation() { Id = Guid.NewGuid(), BusinessId = input.BusinessId, BusinessType = input.BusinessType, FileId = item.Id, Sort = item.Sort }; await _abpFileRelationRepository.InsertAsync(entity); } }
public async Task UpdateAsync(CreateFileRelationsInput input) { var exit_files = _abpFileRelationRepository.GetAll().Where(r => r.BusinessId == input.BusinessId && r.BusinessType == input.BusinessType); foreach (var item in exit_files) { await _abpFileRelationRepository.DeleteAsync(item); } foreach (var item in input.Files) { var entity = new AbpFileRelation() { Id = Guid.NewGuid(), BusinessId = input.BusinessId, BusinessType = input.BusinessType, FileId = item.Id, Sort = item.Sort }; await _abpFileRelationRepository.InsertAsync(entity); } }