Ejemplo n.º 1
0
        public async Task <ProjectDto> CreateProject(CreateProjectDto request, CancellationToken cancellationToken)
        {
            Project createdProject = Project.CreateProject(request.OwnerId, request.Name, request.Description, request.State);
            await _projectRepository.Add(createdProject, cancellationToken);

            ProjectUser projectUserLink = ProjectUser.CreateProjectUser(createdProject.Id, request.OwnerId, createdProject);
            await _projectRepository.AddProjectUser(projectUserLink, cancellationToken);

            foreach (string technologyName in request.Technologies)
            {
                Technology technology = await _projectRepository.GetTechnologyByName(technologyName);

                await _projectRepository.AddProjectTechnology(createdProject, technology, cancellationToken);
            }

            return(_mapper.Map <ProjectDto>(createdProject));
        }