In the past, with ASP.NET MVC, I successfully implemented strongly typed models with relative ease in my Views. But something appears to have changed with ASP.NET Core. I've tried following several tutorial on the subject but none have proved successful.
In my project I have 3 models:
public class App { public string AppName { get; set; } public string AppId { get; set; } } public class AppPage { public string AppId { get; set; } public string Filename { get; set; } public string Content { get; set; } public DateTime CreateDateTimeUtc { get; set; } public DateTime UpdateDateTimeUtc { get; set; } } public class EditorDevelopment { public List<App> Apps { get; set; } public List<AppPage> AppPages { get; set; } }
With code in Startup.cs and my Controller, I've successfully populated 'App' and 'AppPages' with data inappsetting.json. Then I do this:
[HttpGet] public IActionResult Index() { EditorDevelopment editorDev = new EditorDevelopment(); editorDev.Apps = Apps; editorDev.AppPages = AppPages; return View(editorDev); }
But in my View, no matter what I try to do, I simply can't figure out how to implement the strongly typed Model.
Any ideas or good URLs you can recommend?
Robert