private static void AddProjectsToNewTeam(ATAEntities context, List<string> projects, Team team) { projects.ForEach(t => { ATADataModel.Project currentProject = ATACore.Managers.ProjectManager.GetByName(context, t); team.Projects.Add(currentProject); }); }
private static void AddAgentMachinesToNewTeam(ATAEntities context, List<string> agentMachines, Team team) { agentMachines.ForEach(t => { ATADataModel.AgentMachine currentAgentMachine = ATACore.Managers.AgentMachineManager.GetByName(context, t); team.AgentMachines.Add(currentAgentMachine); }); }
public void AddNew(ATAEntities context, string teamName, List<string> projectNames, List<string> agentMachines) { Team team = new Team() { Name = teamName }; AddProjectsToNewTeam(context, projectNames, team); AddAgentMachinesToNewTeam(context, agentMachines, team); context.Teams.Add(team); context.SaveChanges(); }