FINAL exam: ASP.net Core MVC

Ace your homework & exams now with Quizwiz!

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

In ASP.NET Core MVC, controllers are just _____________

C# classes

The MVC convention is to put controllers in the _____________

Controllers folder

@ModelAttribute

Indicates that the argument should be retrieved from the model.

Dependency Injection

Injecting the services that a controller needs as arguments to the controller function

controllers inherit from

Microsoft.AspNetCore.Mvc.Controller class

the ViewBag object

One way to pass data from the controller to the view

can validation go in httppost and httpget?

Yes absolutely

Each public method in a controller is known as an ___________________

action method

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

How do you access the forms data value of an input called "email"?

by declaring a parameter called "email" in the action post method.

In MVC, it is the controller's job to

construct some data and pass it to view

In the MVC pattern, incoming requests are handled by_________.

controllers

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

A route is a rule that is used to

decide how a request is handled.

the ASP.NET routing system, which

decides how URLs map to controllers and actions.

<a asp-action="ListResponses">

hyperlink that sends you to the listresponses page

in MVC where do you typically apply validation?

in methods, in the actions. ACTIONS.

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

Repository.AddResponse(guestResponse);

pass guestResponse as an argument to the Repository.AddResponse method so that the response can be stored.

HTTP POST request

receiving submitted data over HTTP and deciding what to do with it.

the view, which is responsible for

rendering it to HTML.

[HttpGet] public ViewResult RsvpForm() { return View();

responsible for displaying the initial blank form when someone first visits /Home/RsvpForm.

app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Product}/{action=List}/{id?}"); });

setting default route

tag helpers

simplify html in asp.net

[HttpPost] public ViewResult RsvpForm(GuestResponse guestResponse) { return View();

stores response from guest

model, often referred to as a domain model, contains

the C# objects, getters and setters.

A GET request is

what a browser issues normally each time someone clicks a link


Related study sets

Integrated Business Policy and Strategy

View Set

chapter 7: the role of accounting in business

View Set

Geography - Ch. 9 - Caribbean South America

View Set

Section 5.1: Proofs by contradiction (indirect proofs)

View Set

Week 4 Assignment: Blackboard Tools Activity

View Set

Network+ Chapter 4: Network Protocols and Routing

View Set