public Vehiculo GetVehiculoByChofer(long aUserId) { VehiculoChofer pVehiculoChofer = db.DbVehiculoChofer.Include("Vehiculo").Where(vc => vc.Chofer.Id == aUserId).FirstOrDefault(); if (pVehiculoChofer != null) { return(pVehiculoChofer.Vehiculo); } return(null); }
public bool AgregarChoferaVehiculo(Usuario aChofer, Vehiculo aVehiculo) { Usuario pChofer = GetUsuarioBYDbId(aChofer.Id); Vehiculo pVehiculo = GetVehiculoByDbId(aVehiculo.Id); if (aVehiculo != null && aChofer != null) { VehiculoChofer vehiculoChofer = new VehiculoChofer(pChofer, pVehiculo); db.DbVehiculoChofer.Add(vehiculoChofer); db.SaveChanges(); return(true); } return(false); }