0
我想將其轉換爲函數。我將傳遞db對象和MVC模型對象。 這裏是原代碼:如何將數據庫對象和模型對象傳遞到函數
var SomethingApproval = db.Somethings.AsQueryable();
var predicate = PredicateBuilder.True<Something>();
predicate = predicate.And(p => p.Approved == "N");
SomethingApproval = SomethingApproval.AsExpandable().Where(predicate);
我想這樣
Function ApprovedItems (dbObject, modelObject)
{
var SomethingApproval = dbobject.AsQueryable();
var predicate = PredicateBuilder.True<modelObject>();
predicate = predicate.And(p => p.Approved == "N");
SomethingApproval = SomethingApproval.AsExpandable().Where(predicate);
return SomethingApproval
}
有什麼問題? – 2013-06-25 05:41:11