public int CreateTask(CreateTaskDTO dto)
 {
     ProjectUser relation = new ProjectUser();
     PMP.Core.Entities.Task task = ConvertToModel.ConvertToTask(dto);
     task.ProjectId = dto.ProjectId;
     _uWork.TaskRepo.Create(task);
     _uWork.TaskRepo.Save();
     return task.Id;
 }
        public List<UserToAssignDTO> AssignUser(List<int> userIds, int projectId)
        {
            List<User> users = new List<User>();
            foreach (int id in userIds)
            {
                ProjectUser relation = new ProjectUser();
                relation.UserId = id;
                relation.ProjectId = projectId;
                relation.isAdmin = false;
                User user = _uWork.UserRepo.GetById(id);
                users.Add(user);
                _uWork.ProjectUserRepo.Create(relation);
            }
            _uWork.ProjectUserRepo.Save();

            List<UserToAssignDTO> userDto = ConvertToDTO.ConvertToUserToAssingDTO(users);
            return userDto;
        }
        public void CreateProject(CreateProjectDTO dto)
        {
            var project = ConvertToModel.ConvertToProject(dto);
            var user = (User)HttpContext.Current.Session["User"];
            ProjectUser relation = new ProjectUser();
            relation.UserId = user.Id;
            relation.isAdmin = true;
            relation.Project = project;

            _uWork.ProjectUserRepo.Create(relation);
            _uWork.ProjectUserRepo.Save();
        }