Learn ASP.NET Core MVC - Be Ready Next Week Using Visual Studio 2017
By Arnaud Weil
5/5
()
About this ebook
You're a developer who knows nothing about ASP.NET Core MVC. Which is fine, except that you need to start coding your next application using ASP.NET Core 1.1 MVC and Visual Studio 2017.
Don't worry: I have you covered. I've been training hundreds of developers like you during 15 years, and converted my experience into this book. I know from experience teaching what takes more time to learn in ASP.NET Core MVC, and will spend time only where appropriate.
Plus this book is packed with exercises which build up into a full project: you develop a small e-commerce sample web site. You'll allow users to browse for products, and you'll also create a back-end where authenticated users will be able to list and edit products.
Read this book, and you can code your ASP.NET Core MVC application using Visual Studio 2017 within a week.
Arnaud Weil
Arnaud Weil is a born developper: when he was a kid he was controlling his electric train using an Atari ST and some self-made electronics, then as a teenager created and distributed worldwide one of the first Web browsers for some of the first pocket computers, when the Web was just beginning. In fact, he loves coding. Then came .NET and from 2001 Arnaud has been coding using ASP.NET, WPF, WinForms, Silverlight, WCF, XAML for all kind of applications from factory tools to smarphone applications to house control solutions. When not coding, he teaches fellow developers and provides consulting for development teams to reach their targets in the most efficient way. His status as a freelancer allows him to help his clients with many different projects. As things move on, Arnaud also learned to love HTML5, JavaScript and all the great tools that allow building professional software with those technologies. He puts an emphasis on writing modular, clever programs using agile methods and a bunch of automated testing. But what Arnaud enjoys most is helping other developers: that's why he teaches, speaks, and began writing books.
Read more from Arnaud Weil
Learn Kubernetes - Container orchestration using Docker: Learn Collection Rating: 4 out of 5 stars4/5Learn WPF MVVM - XAML, C# and the MVVM pattern Rating: 4 out of 5 stars4/5Learn Kubernetes & Docker - .NET Core, Java, Node.JS, PHP or Python Rating: 0 out of 5 stars0 ratingsLearn Microservices - ASP.NET Core and Docker Rating: 0 out of 5 stars0 ratingsLearn Docker - .NET Core, Java, Node.JS, PHP or Python: Learn Collection Rating: 5 out of 5 stars5/5Learn ASP.NET MVC Rating: 4 out of 5 stars4/5Learn Meteor - Node.js and MongoDB JavaScript platform Rating: 5 out of 5 stars5/5
Related to Learn ASP.NET Core MVC - Be Ready Next Week Using Visual Studio 2017
Related ebooks
Bootstrap for ASP.NET MVC - Second Edition Rating: 5 out of 5 stars5/5ASP.NET Core 3 and React: Hands-On full stack web development using ASP.NET Core, React, and TypeScript 3 Rating: 0 out of 5 stars0 ratingsLearn ASP.NET MVC Rating: 4 out of 5 stars4/5Learning ASP.NET Core MVC Programming Rating: 5 out of 5 stars5/5Learn PHP: Learn PHP Programming in 4 hours! PHP for Beginners - Smart and Easy Ways to learn PHP & MySQL Rating: 4 out of 5 stars4/5Building Web Services with Microsoft Azure Rating: 0 out of 5 stars0 ratingsAmazon EC2 Cookbook Rating: 0 out of 5 stars0 ratingsLearn Microsoft Azure: Step by Step in 7 day for .NET Developers Rating: 0 out of 5 stars0 ratingsPractical Programming 6 in 1: Python Machine Learning, JavaScript, React 17, And Angular With Typescript Rating: 0 out of 5 stars0 ratingsStep by Step: Fault-tolerant, Scalable, Secure AWS Web Stack Rating: 0 out of 5 stars0 ratingsLearn NodeJS in 1 Day: Complete Node JS Guide with Examples Rating: 3 out of 5 stars3/5ASP.NET Core for Jobseekers: Build Career in Designing Cross-Platform Web Applications Using Razor and Entity Framework Core Rating: 0 out of 5 stars0 ratingsAngularJS Web Application Development Blueprints Rating: 0 out of 5 stars0 ratingsBuilding Web APIs with ASP.NET Core Rating: 0 out of 5 stars0 ratingsMicrosoft .NET Interview Questions: MS .NET Certification Review Rating: 0 out of 5 stars0 ratingsImplementing C# 11 and .NET 7.0: Learn how to build cross-platform apps with .NET Core (English Edition) Rating: 0 out of 5 stars0 ratingsMEAN Web Development - Second Edition Rating: 0 out of 5 stars0 ratingsRed Hat Certified Engineer (RHCE) Study Guide: Ansible Automation for the Red Hat Enterprise Linux 8 Exam (EX294) Rating: 0 out of 5 stars0 ratingsNode.js Web Development - Third Edition Rating: 2 out of 5 stars2/5Practical ASP.NET Web API Rating: 0 out of 5 stars0 ratingsMeteor: Full-Stack Web Application Development Rating: 0 out of 5 stars0 ratingsNode.js High Performance Rating: 0 out of 5 stars0 ratingsNode.js, JavaScript, API: Interview Questions and Answers Rating: 5 out of 5 stars5/5Azure SQL Revealed: A Guide to the Cloud for SQL Server Professionals Rating: 0 out of 5 stars0 ratings.NET Core in Action Rating: 0 out of 5 stars0 ratingsJava Design Patterns for Automation and Performance : Convenient Practical Reliable Rating: 0 out of 5 stars0 ratingsJavaScript Regular Expressions Rating: 3 out of 5 stars3/5Reactive State for Angular with NgRx Rating: 0 out of 5 stars0 ratingsGet Programming with Node.js Rating: 0 out of 5 stars0 ratingsServerless Architectures on AWS Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratings
Programming For You
Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Mastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5Learn SQL in 24 Hours Rating: 5 out of 5 stars5/5SQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5TensorFlow in 1 Day: Make your own Neural Network Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5The Unofficial Guide to Open Broadcaster Software: OBS: The World's Most Popular Free Live-Streaming Application Rating: 0 out of 5 stars0 ratingsC++ Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsPython QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsExcel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Raspberry Pi: Beginner's Guide - Learn Raspberry Pi in Easy Steps Rating: 2 out of 5 stars2/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratings
Reviews for Learn ASP.NET Core MVC - Be Ready Next Week Using Visual Studio 2017
1 rating0 reviews
Book preview
Learn ASP.NET Core MVC - Be Ready Next Week Using Visual Studio 2017 - Arnaud Weil
Learn ASP.NET Core MVC
Be ready next week using Visual Studio 2017
Arnaud Weil
© 2016 - 2020 Arnaud Weil
To my wonderful kids. Your love and support fueled this book.
To my parents for teaching me freedom and making sure I can enjoy it.
To the great people that made and make the Web a fantastic platform for content and application delivery.
To my readers who suggested improvements to this book, especially Doğan Kartaltepe.
Table of Contents
Introduction
What this book is not
Prerequisites
How to read this book
Tools you need
Source code
1. Why ASP.NET Core ?
1.1 What is it?
1.2 Why use it?
1.3 Competing technologies
2. ASP.NET Core at its simplest
2.1 Setting up the server
2.2 Very basic Startup configuration
2.3 Barebone configuration
2.4 ASP.NET MVC comes in
3. Creating our Web Site
3.1 Visual Studio scaffolding
3.2 Quick facts about that template
4. ASP.NET MVC inner workings
4.1 Principles
4.2 View
4.3 Bootstrap
4.4 Controller
4.5 It’s your turn to code: do-it-yourself
4.6 Exercise - Create the application
4.7 Exercise solution
5. Razor
5.1 Razor syntax
5.2 Exercise - Add code to the home page
5.3 Exercise solution
5.4 Layout views
5.5 Exercise - Remove some links
5.6 Exercise solution
5.7 Helpers
5.8 Partial views
6. Understanding ASP.NET MVC
6.1 Flashback
6.2 Routing
6.3 Controllers
6.4 Be lazy
6.5 Let’s go all the way
7. Typing things up
7.1 The problem with ViewBag and ViewData
7.2 Using and typing the model
7.3 Conventions and simplicity: introducing the ViewModel
7.4 Exercise
8. Dependency Injection (DI)
8.1 DI steps
8.2 Services registration
8.3 Getting services through injection
8.4 Extension methods for dependency injection
8.5 Wrapping it up
9. Entity Framework Core models
9.1 Exercise - Create the Product model and DbContext
9.2 Exercise solution
9.3 Exercise - Add code that creates a database with some products
9.4 Exercise solution
9.5 Exercise - Display a products list
9.6 Exercise solution
10. Updating server data
10.1 Action parameters
10.2 Word of caution about URLs
10.3 Exercise - Display product details
10.4 Exercise solution
10.5 HTTP Post parameters
10.6 Passing a full blown object
10.7 Sit and watch - Basic product calculator
10.8 Exercise - Add a search box to the products list
10.9 Exercise solution
11. Updating data scenario
11.1 Steps
11.2 Controller
11.3 Automated generation of controller and views
11.4 Exercise - Create the products management back-office
11.5 Exercise solution - Create the products management back-office
12. Doing more with controllers and actions
12.1 Actions can generate more than views
12.2 Exercise - Add images to the products
12.3 Exercise solution - Add images to the products
12.4 Input validation
13. Basic security
13.1 Preventing Cross-Site Scripting
13.2 Rejecting extra fields
13.3 Authenticating users
13.4 Exercise - Secure the back-office
13.5 Exercise solution - Secure the back-office
14. State management
14.1 State stores
14.2 Session state
14.3 Exercise - Add products to a basket
14.4 Exercise solution - Add products to a basket
14.5 Exercise - Basket contents
14.6 Exercise solution - Basket contents
15. Web API
15.1 Use cases
15.2 Creating an API is simple
15.3 API results format
16. Going further
16.1 Creating Razor helpers
16.2 Display and edit templates
Definitions
Dynamic object
Entity Framework
Project
Solution
Solution Explorer
A word from the author
The Learn collection
Introduction
What this book is not
I made my best to keep this book small, so that you can learn ASP.NET Core quickly without getting lost in petty details. If you are looking for a reference book where you’ll find answers to all the questions you may have within the next 4 years of your ASP.NET Core practice, you’ll find other heavy books for that.
My purpose is to swiftly provide you with the tools you need to code your first ASP.NET Core application and be able to look for more by yourself when needed. While some authors seem to pride themselves in having the thickest book, in this series I’m glad I achieved the thinnest possible book for my purpose. Though I tried my best to keep all of what seems necessary, based on my 15 years experience of teaching .NET.
I assume that you know what ASP.NET MVC is and when to use it. In case you don’t, read the following What is ASP.NET Core chapter.
Prerequisites
In order for this book to meet its goals, you must:
Have basic experience creating applications with C#
Have working knowledge of HTML
Know what a Web application is
How to read this book
This book’s aim is to make you productive as quickly as possible. For this we’ll use some theory, several demonstrations, plus exercises. Exercises appear like the following:
Do it yourself: Time to grab your keyboard and code away to meet the given objectives.
Tools you need
The only tool you’ll need to work through that book is Visual Studio 2017. You can get any of those editions:
Visual Studio 2017 Community (free)
Visual Studio 2017 Professional or Entreprise
When installing Visual Studio, make sure you select the ASP.NET and .NET Core components.
Source code
All of the source code for the demos and do-it-yourself solutions is available at https://bitbucket.org/epobb/aspnetcoreexercises
It can be downloaded as a ZIP file, or if you installed GIT you can simply type:
git clone https://bitbucket.org/epobb/aspnetcoreexercis\
es.git
1. Why ASP.NET Core ?
If you’re in a hurry, you can safely skip this chapter and head straight to the Creating our Web Site chapter. This Why ASP.NET Core chapter is there for those that want to know why ASP.NET Core should be used.
1.1 What is it?
In a nutshell, ASP.NET Core is a technology used to create Web applications.
Web applications are used with a browser.