I have the following code in the Controller:
namespace Data
{
internal class Credit
{
[DBMethod("Credit_LoadExhaustedCreditsByAccountID")]
[DBMethodBody(DBMS.SqlServer, @"SELECT TOP 6 *
FROM dbo.[Credit] WITH (NOLOCK)
WHERE AccountID = @AccountID;
AND ExhaustedDate IS NOT NULL
ORDER BY ExhaustedDate DESC;
")]
internal class LoadExhaustedCreditsByAccountID : BaseDBMethod
{
[DBMethodParam("AccountID", typeof(long))]
public long AccountID { get; private set; }
public List<Macu.Credit> Result { get; private set; }
public LoadExhaustedCreditsByAccountID(long accountID)
{
AccountID = accountID;
Result = BaseDBObject.Load<Macu.Credit>(this.ToDataTable());
}
}
}
and database table called Credits.
I would like to get the data results in the top 8 data records in the table grid by using "foreach" or the right code to get all the data results also the sum of credits left and popup a message saying your credits will be expired in a few days until zero credits are exhausted. See the code form MVC file
<%foreach (Finance.Credit eachrecord in Credit. LoadExhaustedCreditsByAccountID(Model.AccountID)). WHERE qry=> qry. {%>
when doing foreach the Credit doesn't contain a definition for LoadExhaustedCreditsByAccountID in the controller,
how to create a definition for the LoadExhaustedCreditsByAccountID.
Please share the code syntax to make the table get data results from the Controller.
Your attention is very appreciated.
Thanks