I made a query in linq, but the result was not expected, it seems the problem is simple but I can not solve it.
Result on label:
{Year = 2016/2017}
Expected result on label:
2016/2017
Controller:
//query
var queryAnoPastoral = (from a in db.AnoPastoral
orderby a.AnoPastoralID descending
select new { a.Ano }).First();
ViewBag.AnoPastoral = queryAnoPastoral.ToString();
View:
@Html.Label((string)@ViewBag.AnoPastoral, htmlAttributes: new { @class = "control-label col-md-2" })