public ActionResult ConnectOwnertoCar(int?Id) { OwnersVehicle ownersVehicle = new OwnersVehicle(); ownersVehicle.Owner = db.Owners.Find(Id); List <Vehcile> vehciles = db.Vehciles.Where(v => v.OwnerId == Id).ToList(); ownersVehicle.Vehicles = vehciles; return(View(ownersVehicle)); }
public override string ToString() { StringBuilder vehicleDetails = new StringBuilder(); vehicleDetails.Append(string.Format( @"Owner Name: {0} Status: {1}", OwnerName, Enum.GetName(typeof(eVehicleStatus), (int)VehicleStatus))); vehicleDetails.Append(string.Format("{0}--------------------{0}", Environment.NewLine)); vehicleDetails.Append(OwnersVehicle.ToString()); return(vehicleDetails.ToString()); }