KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm getting this exception : The specified type member 'Paid' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported. public ActionResult Index() { var debts = storeDB.Orders .Where(o => o.Paid == false) .OrderByDescending(o => o.DateCreated); return View(debts); } My Model class public partial class Order { public bool Paid { get { return TotalPaid >= Total; } } public decimal TotalPaid { get { return Payments.Sum(p => p.Amount); } } Payments is a Related table containing the field amount, The query works if I remove the Where clause showing correct information about the payments, any clue what's wrong with the code? Solved like the answer suggested with : public ActionResult Index() { var debts = storeDB.Orders .OrderByDescending(o => o.DateCreated) .ToList() .Where(o => o.Paid == false); return View(debts); }
Tags (comma-separated)
Save Edits
Cancel