public IQueryable GetRentsFullDetails() { db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s); return(GetRentDetails().GroupJoin(db.spGetCars(), rent => rent.CarID, car => car.ID, (rent, car) => new { rent, car }).SelectMany(z => z.car.DefaultIfEmpty(), (r, c) => new { r.rent.ID, r.rent.StartDate, r.rent.EndDate, r.rent.ActualEndDate, r.rent.UserID, Image = c == null ? null : c.Image }) .GroupJoin(db.spGetUsers(), r => r.UserID, u => u.ID, (r, u) => new { r, u }) .SelectMany(s => s.u.DefaultIfEmpty(), (r, u) => new { r.r.ID, r.r.StartDate, r.r.EndDate, r.r.ActualEndDate, r.r.Image, UserName = u == null ? null : u.UserName, LastName = u == null ? null : u.LastName, FirstName = u == null ? null : u.FirstName })); }
// GET: api/Cars public IQueryable <spGetCars_Result> GetCars() { return(db.spGetCars().AsQueryable()); }