In the ViewBag.Deducciones : bring me the deductions you selected previously.
In the ViewBag.DeducesEmployees : it brings me the deductions that the employee has selected ().
The problem is that for every deduction I go through all the deductions assigned to the employees, how else could I order that.
@foreach (var item in Model)
{
<tr>
<td>@item.EmpId</td>
@*<td>@item.EmpNombre @item.EmpApellido</td>*@
<td><p style="white-space: nowrap;">@item.EmpNombre @item.EmpApellido</p></td>
<td>@item.PueDescripcion</td>
@*<td>@item.sueldo</td>*@
<td> @String.Format("{0:C}", item.sueldo) </td>
<td>@item.Ihss</td>
<td>@item.rap</td>
@*Deducciones Empleado*@
@if (ViewBag.DeduccionesEmpleados != null)
{
foreach (var Deduccion in (List<string>)ViewBag.Deducciones)
{
foreach (var Deduccionees in (IEnumerable<RecursosHumanos.Models.Con_DetalleDeduccionesEmpleado>)ViewBag.DeduccionesEmpleados)
{
if (Deduccionees.EmpId == item.EmpId)
{
if (Deduccionees.DedDescripcion == Deduccion)
{
<th>@Deduccionees.DetDedEmpValor</th>
break;
}
else
{
<th> </th>
}
}
}
}
}