Hi guys
Can someone advise what are the best techniques for controlling an MVC Core2 _LayoutPage ?
I want to be able to pass model data (from the database)
1. Initially I used BaseControllers, but it seems the ViewBag data does not work in MVC Core 2.
2. I tried passing a partial View and accessing it with Jquery, but that would be too cumbersome for a site with lots of pages.
Here is my current project
public class HomeController : MyBaseController /// STEP 1 - inherit custom controller { public class MyBaseController : Controller /// STEP 2 - Create custom controller { public MyBaseController() { ViewData["m"] = "test"; } } } @{ // STEP 3 - Add directive to my layout page var Ehi = ViewData["m"]; } @Ehi // STEP 4 - Insert the variable into my layout page