I am not 100% how to tackle this.
I have a basic controller who retrieves data from a table called transactions
CONTROLLER private NWBA_DBEntities db = new NWBA_DBEntities();
public ActionResult Index()
{
var statements = db.Transactions.ToList();
return View(statements);
}
I have basic model:
public class StatementModel
{
[StringLength(50)]
[Display(Name="Transaction Type: ")]
public string TransactionType { get; set; }
[StringLength(50)]
[Display(Name = "AccountNumber")]
public string AccountNumber { get; set; }
}
My problem is at the View, i cant seem to display the values in a table:
@model Login.Models.StatementModel
@{
ViewBag.Title = "Statements";
}
<h2>Index</h2>
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.TransactionType)
</th>
<th>
@Html.DisplayNameFor(model => model.AccountNumber)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
</tr>
}
</table>
Can some one please help