public Guid AddMuver(muver newMuver) { Guid muverId = new Guid(); using (var db = new MuverDB()) { db.muvers.Add(newMuver); db.SaveChanges(); muverId = newMuver.id; } return muverId; }
public System.Guid AddDriver(driver newDriver, location newLocation) { System.Guid driverId; using (var db = new MuverDB()) { db.locations.Add(newLocation); newDriver.location = newLocation; newDriver.locationId = newLocation.id; db.drivers.Add(newDriver); db.SaveChanges(); driverId = newDriver.id; } return driverId; }
public void AddVehicles(Guid driverId, List<driverVehicle> vehicles) { using (var db = new MuverDB()) { foreach (driverVehicle dv in vehicles) { driverVehicle drv = new driverVehicle(); drv.vehicleType = dv.vehicleType; drv.driverId = driverId; drv.id = Guid.NewGuid(); db.driverVehicles.Add(drv); db.SaveChanges(); } } }