うまくいけば、これは簡単な質問です。私は私が自分で行っていることをやろうとしました。しかし、私は残りの部分を解決することはできません。forループの最後のインデックスをチェックする方法は可能ですか?
すべての行について、日付が高かったり、最後の桁が低いかどうかを確認する必要があります。しかしどうですか?
ご覧のとおり、画像とサンプルコードをご覧ください。
Click and see the image exsample
し、次のコード:
@using Scoutpocket.Models.Database;
@model Tuple<List<Properties>, List<SubProperties>, List<Rating>>
<div class="container">
@foreach (var item in Model.Item1)
{
<br />
<br />
<b>
@item.PropertiesName
</b>
<br />
foreach (var item2 in item.SubProperties)
{
@item2.SubPropertiesName<br />
int count = 2;
int getLast = 1;
foreach (var item3 in item2.rating.Where(x => x.PlayerID == 1).Take(count).OrderByDescending(x => x.Date))
{
for (int i = 0; i < getLast; i++)
{
// Check the index of the last row, and check if the current date is lower or heighter.
<b>Compare date on last and newst</b>
}
<span>Rating ID: @item3.RatingID</span>
<span> | </span>
<span>Value: @item3.Value</span>
<span> | </span>
<span>ScoutID: @item3.ScoutID</span>
<span> | </span>
<span>PlayerID: @item3.PlayerID</span>
<span> | </span>
<span>Date: @item3.Date</span>
<br/>
}
}
}
</div>