Note that there are some explanatory texts on larger screens.

plurals
  1. POProper return type in MVC WEB API after join table result set
    text
    copied!<p>This works in my web api:</p> <pre><code> public IEnumerable&lt;Object&gt; Get() { var passengerVehicle = from vehMake in _Uow.GetRepository&lt;VehicleMake&gt;().Include&lt;VehicleModel&gt;() join passVeh in _Uow.GetRepository&lt;PassengerVehicle&gt;().Include&lt;Vehicle&gt;() .Include(y =&gt; y.Vehicle.VehicleModel) .Include(y =&gt; y.Vehicle.VehicleSubModel) .Include(y =&gt; y.Vehicle.VehicleImages) .Include(y =&gt; y.Vehicle.VehicleLocation) .Include(y =&gt; y.Vehicle.VehiclePrices) on vehMake.Id equals passVeh.Vehicle.VehicleModel.FK_VehicleMakeId select new { vehMake = vehMake.Name, vehMod = passVeh.Vehicle.VehicleModel.Name, vehSubModel = passVeh.Vehicle.VehicleSubModel.Name, vehLocation = passVeh.Vehicle.VehicleLocation, vehImages = passVeh.Vehicle.VehicleImages.ToList(), vehOptions = passVeh.Vehicle.VehicleOptions.ToList(), vehPostHistories = passVeh.Vehicle.VehiclePostHistories.ToList(), vehStats = passVeh.Vehicle.VehicleStatistics.ToList(), vehStatus = passVeh.Vehicle.VehicleStatus, vehPrices = passVeh.Vehicle.VehiclePrices.ToList(), }; return passengerVehicle; } </code></pre> <p><strong>I am not delighted that the return type is "object"</strong></p> <p>I thought perhaps a HttpResponse but apparently that is not correct either.</p> <p>PassengerVehicle has an association with Vehicle.</p> <p>Vehicle has an association with VehicleModel &amp; VehicleSubModel.</p> <p>VehicleModel has an association with VehicleMake.</p> <p>Pretty much everything else are primitives or straight up collections.</p> <p>Suggestions?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload