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