The two images are how my array is. In the first image I have an array with 3 items, the first of the month of April and contains 4 passages. For each ticket I have the respective participants. My problem is in sending this array to my view , because I can not get some properties at runtime as passagem.participante
.
I tried to break this down into three arrays , but when I run via foreach
on the screen it does not display properly with the month and its participants with their passages.
How to make an array only that I could access all properties and play them on the screen?
Here's how the view looks today, but I need to sync the information as I said earlier.
@using WebProvider.BMW_Incentivo.Domain.Models
@model WebProvider.BMW_Incentivo.Admin.Models.GerenciaPassagemModel
@{
ViewBag.Title = "Gerenciamento de Passagens";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/css/pageDataTables.css")" media="screen" />
<link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/css/tableDataTables.css")" media="screen" />
<script src="@Url.Content("~/Content/js/jquery.dataTables.js")" type="text/javascript"></script>
<script src="~/Content/js/pages/GerenciadorPassagem.js"></script>
@using (Html.BeginForm("Index", "GerenciaPassagem", FormMethod.Post))
{
<fieldset id="passagem">
<div style="float: left;">
<label>Mês:</label>
<select id="ListaPeriodo" name="ListaPeriodo" onchange="listaPassagensMes();">
@foreach (var item in Model.ListaPeriodo)
{
<option id="@item.Mes" value="@item.Mes">@item.DescricaoMes</option>
}
</select>
<span class="error">* Campo Obrigatório</span>
</div>
<div style="float: right;">
<label>Ano:</label>
<select id="ListaAno" name="ListaAno">
@*@foreach (int item in Model.Ano)
{*@
<option id="@Model.Ano " value="@Model.Ano "> @Model.Ano</option>
@*}*@
</select>
<span class="error">* Campo Obrigatório</span>
</div>
<table border="2" class="data display datatable" id="tabFiltra">
<thead>
<tr>
<th><span>Acao</span></th>
<th><span>Participante - CPF</span></th>
<th><span>Passagem</span></th>
<th><span>Status</span></th>
</tr>
</thead>
<tbody>
@foreach (Passagem participante in Model.ListaParticipante)
{
<tr>
<td>
<input type="checkbox" id="@participante.Id" name="idsCredito" value="participante.Acao" @(participante.Acao == true || participante.Acao == false ? "checked = 'checked' readonly='readonly' " : string.Empty) />
</td>
<td>
<label id="@participante.Participante.Id" for="participanteId"> @(participante.Passagens != null ? participante.Participante.NomeCompleto + " - " + participante.Participante.CPF : "") </label>
</td>
<td>
<label id="@participante.Passagens" for="participantePassagem">@(participante.Passagens.ToString() != "" ? participante.Passagens.ToString() : "") </label>
</td>
<td>
<label id="@participante.Acao" for="participanteAcao">@(participante.Acao == true ? "Aprovado" : participante.Acao == false ? "Recusado" : "-")</label>
</td>
</tr>
}
</tbody>
</table>
<br />
<br />
<br />
<br />
<br />
<br />
<input type="button" value="Aprovar" id="btAprovar" onclick="Aprovar(); return false;" onblur="Reload();" style="margin-left: 9px;" />
<input type="button" value="Recusar" id="BtRecusar" onclick="Reprovar(); return false;" style="margin-left: 9px;" />
</fieldset>
}
@section Scripts {
@Scripts.Render("~/bundles/knockout")
@Scripts.Render("~/bundles/jqueryui")
}