private async Task UpdateIssueTypes(Project project, List <IssueType> types) { for (int i = 0; i < types.Count; i++) { var existingType = await _issueTypeRepository .FindByCondition(x => x.Name == types[i].Name && x.ProjectId == project.Id) .SingleOrDefaultAsync().ConfigureAwait(false); if (existingType != null) { types[i] = existingType; continue; } else { var newType = new IssueType { Id = Guid.NewGuid(), Name = types[i].Name, ProjectId = project.Id }; await _issueTypeRepository.CreateAsync(newType).ConfigureAwait(false); } } project.Types = types; _projectRepository.Update(project); await _projectRepository.SaveAsync().ConfigureAwait(false); await _issueTypeRepository.SaveAsync().ConfigureAwait(false); }
public async Task <bool> CreateIssueTypeAsync(IssueType issueType) { await _issueTypeRepository.CreateAsync(issueType).ConfigureAwait(false); var created = await _issueTypeRepository.SaveAsync().ConfigureAwait(false); return(created > 0); }