Reputation: 51
What I want to do is a sum between two Models(razor ASP.NET). (they are created in the database) I don't want to do it in the controller, because later I want it not to modify my value. I need to do it in the view one way or another, either by taking out the forEach. Thank you very much I hope your help.
<div class="cuartaParte">
<table style="width: 100%">
@foreach (var item in Model.PresupuestoDetalle){
<tr> //here I want to do the sum
<th scope="row" style="width: 70%; text-align: right">Descuento @[email protected]%</th>
<td>[email protected]</td>
</tr>
}
</table>
</div>
Upvotes: 1
Views: 859
Reputation: 18179
If you want to show the sum between two Models in the view,try to use @()
outside Model.Cliente.Descuento
and Model.DescuentoExtraPorcen%
;
<div class="cuartaParte">
<table style="width: 100%">
@foreach (var item in Model.PresupuestoDetalle){
<tr> //here I want to do the sum
<th scope="row" style="width: 70%; text-align: right">Descuento @([email protected]%)</th>
<td>[email protected]</td>
</tr>
}
</table>
</div>
Upvotes: 1