public void RemoveProjectSlot(ProjectSlot slot)
 {
     if (slot == null)
     {
         throw new ArgumentNullException();
     }
     _context.ProjectSlots.Remove(slot);
 }
 public void AddProjectSlot(ProjectSlot slot)
 {
     if (slot == null)
     {
         throw new ArgumentNullException();
     }
     _context.ProjectSlots.Add(slot);
 }
        public ActionResult <ProjectReadDto> AddProject(ProjectCreateDto newProject)
        {
            var project = _mapper.Map <Project>(newProject);

            _repo.AddProject(project);
            _repo.SaveChanges();
            var newSlot = new ProjectSlot {
                ProjectId = project.Id, Role = "Chef de projet"
            };

            _repo.AddProjectSlot(newSlot);
            _repo.SaveChanges();
            _repo.AddProjectMember(new ProjectMember {
                ProjectId = project.Id, SlotId = newSlot.Id, UserId = newProject.UserId
            });
            return(Ok(_mapper.Map <ProjectReadDto>(project)));
        }