每天我有3个模型:Transaction,Contract和ContractMonth。
我想将某些数据从每日“交易和合同”转移到“合同月份”页面或表,但是我没有错,表为空并且没有任何数据。
这是我的合同月份主管:
public ActionResult Index(int id)
{
var contractMonth = _context.ContractMonth.Where(c => c.ContractsId == id).Include(s => s.contracts).Include(d => d.dailyTransactions).ToList();
return View(contractMonth);
}
这是视图:
<table class="table table-bordered f" cellspacing="0" id="employeetable">
<thead>
<tr>
<th>@Html.DisplayNameFor(model => model.ContractsId)</th>
<th>@Html.DisplayNameFor(model => model.Monthe)</th>
<th>@Html.DisplayNameFor(model => model.Amount)</th>
<th>@Html.DisplayNameFor(model => model.Receipt)</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.contracts.Contract_Num)
</td>
<td>
@Html.DisplayFor(modelItem => item.dailyTransactions.Date)
</td>
<td>
@Html.DisplayFor(modelItem => item.contracts.AmountOfRent)
</td>
</tr>
}
</tbody>
</table>