Esempio n. 1
0
        public void SetTeamToProjectMap(TeamToProject tpmap, TypeOfDBAction type)
        {
            Project p = GetProject(tpmap.ProjectID);

            if (p == null)
            {
                return;
            }
            Team t = GetTeam(tpmap.teamID);

            if (t == null)
            {
                return;
            }
            switch (type)
            {
            case TypeOfDBAction.Add:
                p.Teams.Add(t);
                break;

            case TypeOfDBAction.Delete:
                p.Teams.Remove(t);
                break;
            }
            db.SaveChanges();
        }
Esempio n. 2
0
 public string RemoveTeamFromProject([FromBody] TeamToProject teamToProject)
 {
     using (DataAccessLayer modelAccess = new DataAccessLayer())
     {
         try
         {
             LogHelper.WarnLog("Removing Team: " + teamToProject.teamID + " From Project: " + teamToProject.ProjectID);
             modelAccess.SetTeamToProjectMap(teamToProject, TypeOfDBAction.Delete);
             return("Ok");
         }
         catch (Exception ex)
         {
             LogHelper.ErrorLog("Error Removing Team: " + teamToProject.teamID + " from Project: " + teamToProject.ProjectID);
             return("Error");
         }
     }
 }
Esempio n. 3
0
 public string AddTeamToProject([FromBody] TeamToProject teamToProject)
 {
     using (DataAccessLayer modelAccess = new DataAccessLayer())
     {
         try
         {
             LogHelper.InfoLog("Adding Team: " + teamToProject.teamID + " To Project: " + teamToProject.ProjectID);
             modelAccess.SetTeamToProjectMap(teamToProject, TypeOfDBAction.Add);
             return("Ok");
         }
         catch (Exception ex)
         {
             LogHelper.ErrorLog("Error Adding team: " + teamToProject.teamID + " to project: " + teamToProject.ProjectID + " with error: " + ex.ToString());
             return("Error");
         }
     }
 }