I declare a list in one ActionResult, add to it and pass it through a redirecttoaction to display but theres no data, where abouts is my syntax wrong? I've tested the list and there is data in it (the if statement is within a loop):
Redirect parts:
var list = new List<FailedView>();
if (Metric[1] == "Failed") { list.Add(new FailedView { domain = Metric[0], reason = Metric[2] });
return RedirectToAction("Complete", new { failedView = list } );
}
View ActionResult
public ActionResult Complete(List<FailedView> failedView)
{
return View(failedView);
}
Model
public class FailedView
{
public string domain { get; set; }
public string reason { get; set; }
}
}
View
@model List<Linkofy.Models.FailedView>
<table class="table">
<tr>
<th>
Domain
</th>
<th>
Reason
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.domain)
</td>
<td>
@Html.DisplayFor(modelItem => item.reason)
</td>
</tr>
}