When using collections to process them correctly so that they are attached to the model in the mail without any additional work with legs, you need to make sure that they are indexed correctly, you can do this using the for loop, for example:
@for (int i = 0; i < Model.Count; i++)
{
@Html.HiddenFor(m => m[i].FirstName)
@Html.HiddenFor(m => m[i].LastName)
@Html.HiddenFor(m => m[i].EmailAddress)
<div>
<div class="colFull">@Html.DisplayFor(m => m[i].FirstName)</div>
<div class="colFull">@Html.DisplayFor(m => m[i].LastName)</div>
<div class="colFull">@Html.DisplayFor(m => m[i].EmailAddress)</div>
<div class="colPartial">@Html.CheckBoxFor(m => m[i].IsApproved)</div>
<div class="clear"></div>
</div>
}
To do this, you need to bind the model without any other code :)
: , , displayFors , hiddenFors , For
Edit2: , , , - dev, :
, , hiddenFors, , - , , , , , :
@Html.HiddenFor(m => m[i].FirstName)
@Html.HiddenFor(m => m[i].LastName)
@Html.HiddenFor(m => m[i].EmailAddress)
:
@Html.HiddenFor(m => m[i].ClientId)
, , , , , .
, , , , , - :
[HttpPost]
public ActionResult Administration(List<AdministrationModel> model)
{
var originalMatches = GetAllUsersInfo();
var differences = (from o in originalMatches
join c in model on o.ClientId equals c.ClientId
where c.IsApproved != o.IsApproved).ToList()
return View();
}