How to pass variable from controller in View?

Good afternoon. The controller has variables
public static int suggestionCount { get; set; } = 3;
public static int symbolCount { get; set; } = 1;

Want to use them in the view for this Index.cshtml write the following:
@{ 
 var symbolCount = WebApp.Controllers.HomeController.symbolCount;
 var suggestionCount = WebApp.Controllers.HomeController.suggestionCount;
}

But var and var symbolCount suggestionCount is initialized with zeros and not the values from the controller. Why is this happening and how to fix it?
March 20th 20 at 11:37
2 answers
March 20th 20 at 11:39
You need to pass in the view model. Unfortunately, a quick Google gave a link just for mechanic. This topic there is more or less described, but do not suggest to use it
March 20th 20 at 11:41
If the variables are small, and through ViewBag
in the controller
ViewBag.suggestionCount = 3
ViewBag.symbolCount = 1

and in the view call
@ViewBag.suggestionCount
@ViewBag.symbolCount

Find more questions by tags ASP.NET.NET