示例#1
0
        public void CreateProject(Project project)
        {
            if (ProjectCodeIsNotUnique(project.Code))
            {
                throw new ProjectCodeIsInUseException();
            }

            project.Id        = Guid.NewGuid();
            project.Code      = project.Code.ToUpper();
            project.CreatedAt = DateTime.Now;
            addProjectOwnerToProjectUsers(project);
            project.Users = _userRepo.FindBy(u => project.SelectedUsers.Contains(u.Id)).ToList();

            _projectRepo.Add(project);
        }