text
stringlengths 0
13.4k
|
|---|
you're using Visual Studio, you'll need to open the .csproj
|
project file directly. Visual Studio will later prompt you to save the
|
Solution file, which you should save in the root directory (the first
|
AspNetCoreTodo folder). You can also create an ASP.NET Core
|
project directly within Visual Studio using the templates in File -
|
New Project.
|
A note about Git
|
If you use Git or GitHub to manage your source code, now is a good time
|
to do git init and initialize a Git repository in the project root
|
directory:
|
cd ..
|
git init
|
Make sure you add a .gitignore file that ignores the bin and obj
|
directories. The Visual Studio template on GitHub's gitignore template
|
repo (https://github.com/github/gitignore) works great.
|
18
|
Create an ASP.NET Core project
|
There's plenty more to explore, so let's dive in and start building an
|
application!
|
19
|
MVC basics
|
MVC basics
|
In this chapter, you'll explore the MVC system in ASP.NET Core. MVC
|
(Model-View-Controller) is a pattern for building web applications that's
|
used in almost every web framework (Ruby on Rails and Express are
|
popular examples), plus frontend JavaScript frameworks like Angular.
|
Mobile apps on iOS and Android use a variation of MVC as well.
|
As the name suggests, MVC has three components: models, views, and
|
controllers. Controllers handle incoming requests from a client or web
|
browser and make decisions about what code to run. Views are
|
templates (usually HTML plus a templating language like Handlebars,
|
Pug, or Razor) that get data added to them and then are displayed to the
|
user. Models hold the data that is added to views, or data that is entered
|
by the user.
|
A common pattern for MVC code is:
|
The controller receives a request and looks up some information in a
|
database
|
The controller creates a model with the information and attaches it
|
to a view
|
The view is rendered and displayed in the user's browser
|
The user clicks a button or submits a form, which sends a new
|
request to the controller, and the cycle repeats
|
If you've worked with MVC in other languages, you'll feel right at home
|
in ASP.NET Core MVC. If you're new to MVC, this chapter will teach you
|
the basics and will help get you started.
|
What you'll build
|
20
|
MVC basics
|
The "Hello World" exercise of MVC is building a to-do list application. It's
|
a great project since it's small and simple in scope, but it touches each
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.