It turns out that I have a problem. I can not do the Count
method in a Linq query.
It's about counting a data defined as BYTE
in the database and I can not show it in the view, it returns 0
, null
or all values, but not for example the true
" ni false
, it returns me all or nothing, it does not do the summation, for example that says "they are 16 true and 8 false"
I want to return it in my view with:
Vista
var item in model @Html.DisplayFor(modelItem => item.rme_vigente (este es el dato byte))
It turns out that the Linq query I have is the following and I think it must be wrong, if you return the data of the bbdd.
Driver
public ActionResult Contaorcin() {
var Model = db.View_1.OrderByDescending(model => model.rme_vigente);
int count = Model.Count();
return View(Model.ToList());
}
Also, I think I should have done a method int i = 0;