Update for 23-02-22 14:45

This commit is contained in:
Tyler Perkins 2022-02-23 14:45:01 -05:00
parent 4867437ba5
commit d2fa17e9ea
4 changed files with 62 additions and 2 deletions

View File

@ -145,8 +145,7 @@ class Application
== ASP.NET == == ASP.NET ==
See [[asp.net.wiki]] See [[asp.net.wiki|ASP.NET]]
[[index]] [[index]]

14
tech/MVC.wiki Normal file
View File

@ -0,0 +1,14 @@
= MVC =
MVC or model view controller is a programming paradigm where the aspects of
interacting with an application are broken down into
* Models, or class objects that store data to be manipluated
* Controllers, or classes that serve pages and handle most of the business
logic
* Views, or descriptions/code that creats a user interface. Generally takes a
Model or ViewModel (A class object used just for showing the data) and
displays it, such as html/css
The MVC model is a great way to break down the mental load of developing a
complex application

View File

@ -11,3 +11,6 @@ comparment fusebox, and one above the driver's footwell.
The rear lamp covers are held on by two screws on the inside of the bed, hidden The rear lamp covers are held on by two screws on the inside of the bed, hidden
when the tailgate is up. The other two are on the outside of the truck. when the tailgate is up. The other two are on the outside of the truck.
The main break lamp is a 3457K lamp, often sold as a 3457 lamp. They go for
about 5 dollars.

View File

@ -1,3 +1,47 @@
== ASP.NET == == ASP.NET ==
ASP.NET is an open source cross platform web framework for C# 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.