public async Task AssignIssueToUser(AssignIssueToUserInput input) { // authorization AuthorizationService.CheckPermission("TaskAssignmentPermission"); // validation _validationService.Validate(input); // domain var user = await _userRepository.GetByIdAsync(input.UserId); var issue = await _issueRepository.GetByIdAsync(input.IssueId); issue.AssignTo(user, _issueAssignmentPolicy); await _issueRepository.UpdateAsync(issue); // notification if (SessionService.UserId != user.Id) { _userEmailer.IssueAssigned(user, issue); } // logging _logger.LogInformation($"Assigned issue {issue} to user {user}"); }
public void AssignIssueToUser(AssignIssueToUserInput input) { //TODO: Unit of work / transaction management AuthorizationService.CheckPermission("TaskAssignmentPermission"); _validationService.Validate(input); var user = _userRepository.Get(input.UserId); var issue = _issueRepository.Get(input.IssueId); _issueManager.Assign(issue, user); if (SessionService.UserId != user.Id) { _userEmailer.IssueAssigned(user, issue); } Logger.LogInformation($"Assigned issue {issue} to user {user}"); }