コード例 #1
0
        public async Task <IActionResult> CreateTeamGoal(CreateTeamGoalsModel model)
        {
            var request = new AssignGoalToTeamOperationRequest
            {
                TopicIds = model.TopicIds
            };
            await _assignGoalToTeamOperation.Execute(request);

            return(Ok());
        }
        public async Task Execute(AssignGoalToTeamOperationRequest request)
        {
            var team = (await _authorizationContext.CurrentEmployee())
                       .ManagedTeam;

            foreach (var employee in team.Employees)
            {
                var assignToEmployeeRequest = new AssignGoalsToEmployeeOperationRequest
                {
                    EmployeeId = employee.Id,
                    TopicIds   = request.TopicIds
                };
                try
                {
                    await _assignGoalToEmployeeOperation.Execute(assignToEmployeeRequest);
                }
                catch (ApplicationException)
                {
                    //swallow
                }
            }
        }