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