コード例 #1
0
        public async Task SeedAsync(DataSeedContext context)
        {
            var issue1 = await _issueManager.CreateAsync(Guid.NewGuid(), "Issue1Title", "Issue1Text");

            issue1.AssignedUserId = TestData.User1Id;
            await _issueRepository.InsertAsync(issue1);

            var issue2 = await _issueManager.CreateAsync(Guid.NewGuid(), "Issue2Title", "Issue2Text");

            issue2.AssignedUserId = TestData.User1Id;
            await _issueRepository.InsertAsync(issue2);

            var issue3 = await _issueManager.CreateAsync(Guid.NewGuid(), "Issue3Title", "Issue3Text");

            issue3.AssignedUserId = TestData.User2Id;

            await _issueRepository.InsertAsync(issue3);

            var issue4 = await _issueManager.CreateAsync(Guid.NewGuid(), "Issue3Title", "Issue3Text");

            issue4.AssignedUserId = TestData.User2Id;
            await _issueRepository.InsertAsync(issue4);
        }
コード例 #2
0
        public async Task <IssueDto> CreateAsync(CreateIssueDto input)
        {
            var issue = await _issueManager.CreateAsync(input.RepositoryId, input.Title, input.Text);

            // Apply additional domain actions
            if (input.AssignedUserId.HasValue)
            {
                var user = await _userRepository.GetAsync(input.AssignedUserId.Value);

                await _issueManager.AssignToAsync(issue, user);
            }

            // Save
            await _issueRepository.InsertAsync(issue);

            return(ObjectMapper.Map <Issue, IssueDto>(issue));
        }