Hi,
I am working on an ASP.NET MVC app using Web API.
I am trying to create the ability to pull back a subset of data to display on a page.
So I have my repository defined like this:
using IBCPackTrack.Models;
using System;
using System.Data.Entity;
using System.Linq;
namespace IBCPackTrack.Data
{
public class DeliveryHistoryRepository : GenericRepository<DeliveryHistory>
{
public DeliveryHistoryRepository(DbContext context)
: base(context)
{
}
public IQueryable<DeliveryHistory> GetByRouteId(Guid id)
{
return DbSet.Select(dh => new DeliveryHistory
{
del_pk = dh.del_pk,
del_time = dh.del_time,
});
}
}
}
This is giving me a syntax error under the Select in "DbSet.Select":
'System.Data.Entity.DbSet' does not contain a definition for 'Select'
I'm not sure why as this code works fine in another application that I am using as an example.
Basically what I want to do is accept a key and use that key to produce a subset of data from DeliveryHistory like this SQL would produce:
SELECT DeliveryHistory.*
FROM DeliveryHistory
INNER JOIN RunSheetDetails on del_rndfk = rnd_pk
INNER JOIN RunsheetHeaders on rnd_rnhfk = rnh_pk
WHERE rnh_rtefk = @RouteId
Any help appreciated!