public void SetEmployeeSupervisor(EmployeeSupervisor Item)
        {   // Get a reference to the employee
            var employee = ds.Employees.Find(Item.Employee);

            if (employee == null)
            {
                return;
            }

            // Get a reference to the supervisor
            var supervisor = ds.Employees.Find(Item.Supervisor);

            if (supervisor == null)
            {
                return;
            }

            //find old supervisor
            var prevSupervisor = ds.Employees.Find(employee.ReportsTo);

            if (prevSupervisor != null)
            {
                prevSupervisor.Employee1.Remove(employee);
            }
            // Make the changes, save, and exit
            supervisor.Employee1.Add(employee);
            employee.Employee2 = supervisor;
            employee.ReportsTo = supervisor.EmployeeId;
            ds.SaveChanges();
        }
        public void ClearEmployeeSupervisor(EmployeeSupervisor item)
        {
            // Get a reference to the employee
            var employee = ds.Employees.Find(item.Employee);

            if (employee == null)
            {
                return;
            }

            // Get a reference to the supervisor
            var supervisor = ds.Employees.Find(item.Supervisor);

            if (supervisor == null)
            {
                return;
            }

            // Make the changes, save, and exit
            if (employee.ReportsTo == supervisor.EmployeeId)
            {
                employee.ReportsTo = null;
                employee.Employee2 = null;
                ds.SaveChanges();
            }
        }
        public void PutClearSupervisor(int id, [FromBody] EmployeeSupervisor item)
        {
            // Ensure that an "editedItem" is in the entity body
            if (item == null)
            {
                return;
            }

            // Ensure that the id value in the URI matches the id value in the entity body
            if (id != item.Employee)
            {
                return;
            }

            // Ensure that we can use the incoming data
            if (ModelState.IsValid)
            {
                // Attempt to update the item
                m.ClearEmployeeSupervisor(item);
            }
            else
            {
                return;
            }
        }