没有合适的资源?快使用搜索试试~ 我知道了~
首页ASP.NET.Core.1.1.For.Beginners.How.to.Build.a.MVC.Website.2017
ASP.NET.Core.1.1.For.Beginners.How.to.Build.a.MVC.Website.2017
![](https://csdnimg.cn/release/wenkucmsfe/public/img/star.98a08eaa.png)
ASP.NET.Core.1.1.For.Beginners.How.to.Build.a.MVC.Website.2017
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/9849313/bg1.jpg)
ASP.NET Core 1.1 MVC
For Beginners
How to build a Video Course Website
![](https://csdnimg.cn/release/download_crawler_static/9849313/bg2.jpg)
ASP.NET Core 1.1 MVC For Beginners - How to build a Video Course Website
Overview .............................................................................................................................. 1
Setup ................................................................................................................................ 2
Other Titles by the Author ............................................................................................... 2
MVC 5 – How to Build a Membership Website (video course) ................................... 2
Store Secret Data in .NET Core Web App with Azure Key Vault (video course) .......... 3
C# for Beginners: The Tactical Guidebook................................................................... 3
ASP.NET MVC 5 – Building a Website: The Tactical Guidebook .................................. 4
Source Code and Bonus Materials................................................................................... 5
Disclaimer – Who Is This Book for? ................................................................................. 5
Rights ............................................................................................................................... 5
About the Author ............................................................................................................ 6
Part 1: ASP.NET Core 1.1 MVC Your First Application ........................................................ 7
1. Your First ASP.NET Core Application ............................................................................... 8
Creating the Solution and Project ................................................................................... 8
The Project Layout and the File System .................................................................... 11
Important Files .......................................................................................................... 12
Compiling the Solution .............................................................................................. 13
The Startup.cs File ..................................................................................................... 14
Adding a Configuration Service ..................................................................................... 15
Creating a Service .......................................................................................................... 18
Example ..................................................................................................................... 18
Adding the Interface .............................................................................................. 19
Adding the HardcodedMessageService Class ........................................................ 20
Configure and Use the HardcodedMessageService Class ..................................... 20
Add and Use the ConfigurationMessageService Class .......................................... 22
Summary ........................................................................................................................ 24
![](https://csdnimg.cn/release/download_crawler_static/9849313/bg3.jpg)
ASP.NET Core 1.1 MVC For Beginners - How to build a Video Course Website
2. Middleware ................................................................................................................... 25
How Does Middleware Work? ...................................................................................... 25
IApplicationBuilder ........................................................................................................ 26
Handling Exceptions .................................................................................................. 28
Serving Up Static Files ................................................................................................... 31
Serving Up Default Files ................................................................................................. 33
Setting Up ASP.NET MVC ............................................................................................... 33
Adding the MVC NuGet Package ............................................................................... 34
Summary ........................................................................................................................ 36
3. MVC Controllers ............................................................................................................ 37
Routing .......................................................................................................................... 38
Convention-Based Routing ........................................................................................ 39
Implement Routing ................................................................................................ 40
Adding Another Controller .................................................................................... 42
Attribute Routing ....................................................................................................... 43
IActionResult ................................................................................................................. 46
Implementing ContentResult .................................................................................... 47
Using a Model Class ................................................................................................... 47
Introduction to Views .................................................................................................... 49
A View with a Data Collection ....................................................................................... 50
Adding a Data Service .................................................................................................... 53
Summary ........................................................................................................................ 57
4. Models ........................................................................................................................... 58
View Model Example ..................................................................................................... 59
Changing the Folder Structure .................................................................................. 59
Adding the View Model ............................................................................................. 59
Using the View Model ............................................................................................... 60
![](https://csdnimg.cn/release/download_crawler_static/9849313/bg4.jpg)
ASP.NET Core 1.1 MVC For Beginners - How to build a Video Course Website
Adding a Details View ................................................................................................ 61
Adding a Create View .................................................................................................... 65
Refactoring the Application ....................................................................................... 66
Adding the HTTP GET Create Action and the Create View ........................................ 68
Adding the VideoEditViewModel Class ..................................................................... 70
Adding the HTTP POST Create Action ........................................................................ 71
Data Annotations ........................................................................................................... 76
Preparing the Crate View for Validation ................................................................... 77
Adding Validation to the Create View ................................................................... 77
Validating the Model on the Server .......................................................................... 78
Adding Data Annotations in the Video Entity and the VideoEditViewModel Class .. 79
Summary ........................................................................................................................ 82
5. Entity Framework .......................................................................................................... 83
Installing Entity Framework and User Secrets ............................................................... 83
Adding the VideoDbContext Class ............................................................................. 85
Configuration in the Startup Class ............................................................................. 86
Adding the Initial Migration and Creating the Database ........................................... 88
Adding the SqlVideoData Service Component .............................................................. 90
Implementing the SqlVideoData Service Component Class ...................................... 90
Summary ........................................................................................................................ 93
6. Razor Views ................................................................................................................... 94
Layout Views .................................................................................................................. 94
Adding the _Layout View ........................................................................................... 95
Altering the Content Views ....................................................................................... 95
The _ViewStart file ........................................................................................................ 99
The _ViewImports file ................................................................................................. 100
Tag Helpers .................................................................................................................. 101
![](https://csdnimg.cn/release/download_crawler_static/9849313/bg5.jpg)
ASP.NET Core 1.1 MVC For Beginners - How to build a Video Course Website
Altering the Index View ........................................................................................... 102
Adding an Edit View and Its Actions ........................................................................ 103
Refactoring the IVideoData Service ......................................................................... 106
Partial Views ................................................................................................................ 109
View Components ....................................................................................................... 112
Adding a View Component for the IMessageService Service .................................. 112
Summary ...................................................................................................................... 115
7. Forms Authentication .................................................................................................. 116
Adding the Authorize and AlowAnonymous Attributes .............................................. 117
Configuring the Identity Framework ........................................................................... 118
Creating the AspNet Identity Database Tables ........................................................... 120
User Registration ......................................................................................................... 121
Login and Logout ......................................................................................................... 126
Adding the _Login Partial View................................................................................ 126
Adding the Logout Action ........................................................................................ 128
Adding the LoginViewModel Class .......................................................................... 129
Adding the HTTP GET Login Action .......................................................................... 130
Adding the HTTP POST Login Action ........................................................................ 131
Adding the Login View ............................................................................................. 133
Summary ...................................................................................................................... 135
8. Front-End Frameworks ................................................................................................ 137
Installing Bower and the Frameworks ......................................................................... 137
Styling with Bootstrap ................................................................................................. 140
Adding a Navigation Bar .......................................................................................... 141
Styling the Index View ............................................................................................. 143
Adding Client-Side Validation ...................................................................................... 145
Summary ...................................................................................................................... 147
剩余410页未读,继续阅读
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)