コード例 #1
0
 public ActionResult Edit(Machine machine, int EngineerId)
 {
     _db.Machines.Add(machine);
     if (EngineerId != 0)
     {
         _db.EngineerMachine.Add(new EngineerMachine()
         {
             EngineerId = EngineerId, MachineId = machine.MachineId
         });
     }
     _db.Entry(machine).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
コード例 #2
0
 public ActionResult Edit(Engineer engineer, int MachineId)
 {
     _db.Engineers.Add(engineer);
     if (MachineId != 0)
     {
         _db.EngineerMachine.Add(new EngineerMachine()
         {
             EngineerId = engineer.EngineerId, MachineId = MachineId
         });
     }
     _db.Entry(engineer).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }