public SubprocessDTO PutSubprocess(int id, [FromBody] SubprocessDTO s) { var sp = dbm.FindSubprocessByID(id); bool changesMade = false; if (s.Description != null && s.Description != "" && sp.Description != s.Description) { sp.Description = s.Description; changesMade = true; } if (s.ProcessID > 0 && sp.Process.ProcessID != s.ProcessID) { sp.Process = dbm.FindProcessByID(s.ProcessID); changesMade = true; } if (s.TeamID > 0 && sp.Team.TeamID != s.TeamID) { sp.Team = dbm.FindTeamByID(s.TeamID); changesMade = true; } if (changesMade) { db.SaveChanges(); } return(converter.SubprocessToDTO(sp)); }
public EmployeeTeamDTO PutEmployeeTeam(int id, [FromBody] EmployeeTeamDTO e) { var empTeam = dbm.FindEmployeeTeamByID(id); if (empTeam.Employee.EmployeeID != e.EmployeeID) { empTeam.Employee = dbm.FindEmployeeByID(e.EmployeeID); } if (empTeam.Team.TeamID != e.TeamID) { empTeam.Team = dbm.FindTeamByID(e.TeamID); } db.SaveChanges(); return(converter.EmployeeTeamToDTO(empTeam)); }
public TeamDTO GetTeam(int id) { return(converter.TeamToDTO(dbm.FindTeamByID(id))); }
public EmployeeTeam DTOToEmployeeTeam(EmployeeTeamDTO a) { return(new EmployeeTeam { Employee = dbm.FindEmployeeByID(a.EmployeeID), EmployeeTeamID = a.EmployeeTeamID, Team = dbm.FindTeamByID(a.TeamID) }); }