== ASP.NET == ASP.NET is an open source cross platform web framework for C# == [[MVC]] == See [[MVC]] as a concept. The MVC model as it pertains to ASP.NET is very straightforward. There are Models, which consist of objects, gernerally in the APPNAME.Models namespace. Next there are Controllers, which are classes with methods for each operations on the site (IE view/create), etc. == Site structure == For some controller, XYZController, the base, or Index() of the controller, can be accessed via mysite.com/XYZ. For other methods on the site, such as create, one must call mysite.com/XYZ/Create. This applies for all methods in the Controller class following signature `public IActionResult MyCustomMethod()`. These usually end with a `return View()` == Views == A cshtml block may be created using a `@{}` block. Here C# can be placed, however it is always ran by an interpretter at runtime, and is therefore not recomended often. === Passing data to views === A view can take paramaters, primarily a single object, via passing it to the `View()` constructor. In the .cshtml file (the view), one must then add the line `@model APPNAME.Models.SomeModel` to specify the exact model type being passed in. NOTE: `@using APPNAME.Models` is required at the top of the view === Showing Controller data in views === A view can display data from a passed model via the `@Model.MEMBER_VALUE` syntax anywhere in the HTML. === ViewBag === The ViewBag is an object that can be accessed in the Controller, and any sub type can be apecified. IE `ViewBag.Title = "Some title"` is valid, without declaring Title as a string or even existing first.