0
I would like to realize a simple sum of some values in my View. I tried to accomplish it that way:
@foreach (ReceitaIndexVM receita in Model)
{
decimal Total = 0;
<div class="col-lg-2 col-sm-2">
<div class="card bg-info text-white">
<div class="card-body">
<h6 class="card-title">Total de Receitas</h6>
@{
int cont = receita.Id.ToString("C2").Count();
for (int i = 0; i < cont; i++)
{
Total += receita.Valor;
}
}
<h2 class="lead">@Total</h2>
</div>
</div>
</div>
}
I even put a Count of @recipe. Id and it brings the value of 7. What I am doing wrong?
Can you help me? Thank you!
Thanks for the help Filipe, but he accuses this error: Error CS0021 Cannot apply Indexing with [] to an Expression of type 'Receitaindexvm'
– João Faustino