FINAL exam: ASP.net Core MVC Latest
2023 Rated A+
In the MVC pattern, incoming requests are handled by_________. ✔✔controllers
In ASP.NET Core MVC, controllers are just _____________ ✔✔C# classes
controllers inherit
...
FINAL exam: ASP.net Core MVC Latest
2023 Rated A+
In the MVC pattern, incoming requests are handled by_________. ✔✔controllers
In ASP.NET Core MVC, controllers are just _____________ ✔✔C# classes
controllers inherit from ✔✔Microsoft.AspNetCore.Mvc.Controller class
Each public method in a controller is known as an ___________________ ✔✔action method
The MVC convention is to put controllers in the _____________ ✔✔Controllers folder
the ASP.NET routing system, which ✔✔decides how URLs map to controllers and actions.
A route is a rule that is used to ✔✔decide how a request is handled.
public ViewResult Index() {
return View("MyView");
} ✔✔create the ViewResult object by calling the View method, specifying the name of the view
that I want to use, which is MyView
In MVC, it is the controller's job to ✔✔construct some data and pass it to view
the view, which is responsible for ✔✔rendering it to HTML.
the ViewBag object ✔✔One way to pass data from the controller to the view
model, often referred to as a domain model, contains ✔✔the C# objects, getters and setters.
@ModelAttribute ✔✔Indicates that the argument should be retrieved from the model.
asp-action ✔✔asp-action attribute is an instruction to add an href attribute to the a element that
contains a URL for an action method
tag helpers ✔✔simplify html in asp.net
A GET request is ✔✔what a browser issues normally each time someone clicks a link
HTTP POST request ✔✔receiving submitted data over HTTP and deciding what to do with it.
model binding, a useful MVC feature whereby ✔✔incoming data is parsed and the key/value
pairs in the HTTP request are used to populate properties of domain model types
Dependency Injection ✔✔Injecting the services that a controller needs as arguments to the
controller function
[HttpGet]
public ViewResult RsvpForm() {
return View(); ✔✔responsible for displaying the initial blank form when someone first visits
/Home/RsvpForm.
[HttpPost] public ViewResult RsvpForm(GuestResponse guestResponse) {
return View(); ✔✔stores response from guest
Repository.AddResponse(guestResponse); ✔✔pass guestResponse as an argument to the
Repository.AddResponse method so that the response can be stored.
✔✔hyperlink that sends you to the listresponses page
in MVC where do you typically apply validation? ✔✔in methods, in the actions. ACTIONS.
How do you access the forms data value of an input called "email"? ✔✔by declaring a parameter
called "email" in the action post method.
when generating migration scripts, which parameter do we have to use in the package manager
console to specify which database we want to generate the scripts for? ✔✔-context
what methods are used to create services that are required for session management?
✔✔AddMemoryCache and Add Session
can validation go in httppost and httpget? ✔✔Yes absolutely
app.UseMvc(routes => {
routes.MapRoute(
name: "default",
template: "{controller=Product}/{action=List}/{id?}");
}); ✔✔setting default route
[Show More]