Example #1
0
        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));
        }
Example #2
0
 public EmployeeDTO GetEmployee(int id)
 {
     return(converter.EmployeeToDTO(dbm.FindEmployeeByID(id)));
 }
Example #3
0
 public EmployeeTeam DTOToEmployeeTeam(EmployeeTeamDTO a)
 {
     return(new EmployeeTeam {
         Employee = dbm.FindEmployeeByID(a.EmployeeID), EmployeeTeamID = a.EmployeeTeamID, Team = dbm.FindTeamByID(a.TeamID)
     });
 }