没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
215页
ASP.NET Core 1.1 Web API For Beginners How To Build a Web API ASP.NET Core 1.1 Web API For Beginners How To Build a Web API ASP.NET Core 1.1 Web API For Beginners How To Build a Web API
资源推荐
资源详情
资源评论
ASP.NET Core 1.1 Web API
for Beginners
ASP.NET Core 1.1 MVC for Beginners - How to Build a Video Course Website
Overview .............................................................................................................................. 1
Setup ................................................................................................................................ 2
Other Titles by the Author ............................................................................................... 3
Books by the Author .................................................................................................... 3
Store Secret Data in .NET Core Web App with Azure Key Vault (video course) .......... 4
MVC 5 – How to Build a Membership Website (video course) ................................... 4
Source Code and Bonus Materials................................................................................... 5
Disclaimer – Who Is This Book for? ................................................................................. 5
Rights ............................................................................................................................... 6
About the Author ............................................................................................................ 6
Part 1: Introduction to ASP.NET Core 1.1 Web API ............................................................. 9
1. Introduction ................................................................................................................... 11
Introduction ................................................................................................................... 11
What Is ASP.NET Core? .................................................................................................. 11
What Is the .NET Core Framework? .............................................................................. 11
What Is .NET Standard? ................................................................................................. 12
Full .NET Framework vs. .NET Core ............................................................................... 12
Creating the Solution and Project ................................................................................. 12
Important Files .......................................................................................................... 15
Program.cs ............................................................................................................. 15
Other Files ............................................................................................................. 16
Compiling the Solution .............................................................................................. 17
The Startup.cs File ..................................................................................................... 18
Reading from a Configuration File ................................................................................. 19
Reading from the Secrets.Json File ................................................................................ 22
Summary ........................................................................................................................ 24
ASP.NET Core 1.1 Web API for Beginners
2. Middleware ................................................................................................................... 25
Introduction ................................................................................................................... 25
How Does Middleware Work? ...................................................................................... 25
IApplicationBuilder ........................................................................................................ 26
Handling Exceptions .................................................................................................. 28
Installing Postman ......................................................................................................... 31
Setting Up ASP.NET MVC/Web API ............................................................................... 32
Adding the MVC NuGet Package ............................................................................... 32
Summary ........................................................................................................................ 35
3. Controllers ..................................................................................................................... 37
Introduction ................................................................................................................... 37
Routing .......................................................................................................................... 38
HTTP Verbs and HTTP Attributes ................................................................................... 41
Summary ........................................................................................................................ 42
4. Models ........................................................................................................................... 43
Introduction ................................................................................................................... 43
POCO Models................................................................................................................. 43
Data Annotations ........................................................................................................... 45
Summary ........................................................................................................................ 46
Part 2: ASP.NET Core 1.1 Web API Using In-Memory Data .............................................. 47
5. Adding In-Memory Data Storage ................................................................................... 49
Introduction ................................................................................................................... 49
Creating the Main DTOs ................................................................................................ 50
Creating the In-Memory Data Collections ..................................................................... 51
Summary ........................................................................................................................ 53
6. Adding an In-Memory Data Service ............................................................................... 55
Introduction ................................................................................................................... 55
ASP.NET Core 1.1 Web API for Beginners
Adding the BookstoreMockRepository Data Service .................................................... 56
Summary ........................................................................................................................ 58
7. Adding the Publishers Controller................................................................................... 59
Introduction ................................................................................................................... 59
Status Codes .................................................................................................................. 59
Adding the Publishers Controller .................................................................................. 61
Get a List of Publishers (GET) ........................................................................................ 62
Get a Single Publisher (GET) .......................................................................................... 66
Adding the GetPublisher Method to the Service ...................................................... 67
Calling the GetPublisher Method from the Controller .............................................. 68
Add Status Code Pages .................................................................................................. 73
Add a Publisher (POST) .................................................................................................. 74
Adding the PublisherCreateDTO Class ....................................................................... 75
Adding the AddPublisher Method to the Service ...................................................... 76
Adding the Save Method to the Service .................................................................... 77
Adding the Post Action to the PublishersController Class ........................................ 78
Update a Publisher (PUT) .............................................................................................. 82
Adding the PublisherUpdateDTO Class ..................................................................... 82
Adding the UpdatePublisher Method to the Service ................................................ 83
Adding the PublisherExists Method to the Service ................................................... 84
Adding the Put Action to the PublishersController Class .......................................... 85
Partially Update a Publisher (PATCH) ............................................................................ 88
Delete a Publisher (DELETE) .......................................................................................... 92
Adding the DeleteBook Method to the Service ........................................................ 92
Adding the DeletePublisher Method to the Service .................................................. 93
Adding the Delete Action Method in the PublishersController Class ....................... 94
Summary ........................................................................................................................ 97
ASP.NET Core 1.1 Web API for Beginners
8. Adding the Books Controller ......................................................................................... 99
Introduction ................................................................................................................... 99
Adding the BooksController Class ............................................................................... 100
Get a List of Books (GET) ............................................................................................. 101
Adding the GetBooks Method to the IBookstoreRepository Interface ................... 101
Adding the Get Action Method to the BooksController Class ................................. 102
Get a Book (GET).......................................................................................................... 104
Adding the GetBook Method to the IBookstoreRepository Interface .................... 104
Adding the Get Action Method to the BooksController Class ................................. 105
Add a Book (POST) ....................................................................................................... 106
Adding the BookCreateDTO Class ........................................................................... 107
Adding the AddBook Method to the Service ........................................................... 108
Adding the Post Action to the BooksController Class ............................................. 109
Update a Book (PUT) ................................................................................................... 112
Adding the BookUpdateDTO Class .......................................................................... 112
Adding the UpdateBook Method to the Service ..................................................... 113
Adding the Put Action to the BooksController Class ............................................... 114
Partial Update of a Book (PATCH) ............................................................................... 117
Delete a Book (DELETE) ............................................................................................... 120
Summary ...................................................................................................................... 122
Part 3: Creating an Entity Framework Service ................................................................. 123
9. Entity Classes ............................................................................................................... 125
Introduction ................................................................................................................. 125
Adding the Publisher and Book Entity Classes ............................................................ 125
Summary ...................................................................................................................... 128
10. Entity Framework and AutoMapper .......................................................................... 129
Introduction ................................................................................................................. 129
剩余214页未读,继续阅读
资源评论
birdxxxx
- 粉丝: 3
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功