【发布时间】:2020-08-01 04:11:37
【问题描述】:
public ActionResult Dashboard()
{
var data = Processor.LoadBarangays();
List<BarangayModel> barangays = new List<BarangayModel>();
**int totalConfirmed = 0;
int totalPUI = 0;
int totalPUM = 0;**
foreach (var row in data)
{
***totalConfirmed = +row.Confirmed;
totalPUI = +row.PUI;
totalPUM = +row.PUM;***
barangays.Add(new BarangayModel
{
Barangay = row.Barangay,
Confirmed = row.Confirmed,
PUI = row.PUI,
PUM = row.PUM
});
}
return View(barangays);
}
我有上面的代码来显示这个表格:red mark 现在我添加了上面强调的代码,以便我可以在蓝色标记的卡片中显示它:blue mark。如何在视图中显示变量的值?我可以在单个控制器中使用多个视图吗?谢谢。
【问题讨论】:
标签: c# asp.net-mvc model-view-controller bootstrap-4