public async Task Create(Project project) { if (project is null) { throw new ArgumentNullException(nameof(project)); } await _projectRepository.Create(project.Adapt <ProjectEntity>()); }
public async Task Create(Project project, string userIdentityLogin) { if (project is null) { throw new ArgumentNullException(nameof(project)); } if (string.IsNullOrEmpty(userIdentityLogin)) { throw new ArgumentException("message", nameof(userIdentityLogin)); } await _projectRepository.Create(project.Adapt <ProjectEntity>(), userIdentityLogin); }
public async Task <ProjectResponse> Handle(CreateProjectRequest request) { var manager = await _userRepository.ReadById(request.ManagerUserId); if (manager == default) { throw new ArgumentNullException(nameof(manager)); } var project = new Project(request.Name, manager); project.UpdateDescriptionTo(request.Description); _projectRepository.Create(project); await _projectRepository.PersistChanges(); return(project.Adapt <ProjectResponse>()); }