Attempts were as follows:
var query1 = Db.ProductView.Where(w => w.DisplayFlag == "Y");
var paging = query1.Include(i => i.ProductImages).Select(s =>
new Products()
{
ProductCode = s.ProductCode,
DesignCode = s.DesignCode,
Code1 = s.Code1,
Code2 = s.Code2,
ProductImages = s.ProductImages.Where(i => (i.ImageNo == 1 & i.ImageType == "LS") ).Select(i => i),
ProductCoupons = Db.Database.SqlQuery<Coupon>("EXEC [USP_Front_EShop_Coupon_Select_By_ProductCode] @ProductCode", s.ProductCode)
}
);
However, the following error was returned:
*LINQ to Entities does not recognize the method 'System.Collections.Generic.IEnumerable `1 [Lesmore1.Models.Coupon SqlQuery [Coupon] (System.String, System.Object [])' method, and this method cannot be translated into a store expression. Help us understand what is going wrong ..