public ActionResult Edit(Machine machine, List <int> Engineers)
 {
     if (Engineers.Count != 0)
     {
         foreach (int engineer in Engineers)
         {
             _db.EngineerMachine.Add(new EngineerMachine()
             {
                 EngineerId = engineer, MachineId = machine.MachineId
             });
         }
     }
     _db.Entry(machine).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = machine.MachineId }));
 }
 public ActionResult Edit(Engineer engineer, List <int> Machines)
 {
     if (Machines.Count != 0)
     {
         foreach (int machine in Machines)
         {
             _db.EngineerMachine.Add(new EngineerMachine()
             {
                 MachineId = machine, EngineerId = engineer.EngineerId
             });
         }
     }
     _db.Entry(engineer).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = engineer.EngineerId }));
 }