Instant Download Building Web Applications with .NET Core 2.1 and JavaScript: Leveraging Modern JavaScript Frameworks - Second Edition Philip Japikse PDF All Chapters
Instant Download Building Web Applications with .NET Core 2.1 and JavaScript: Leveraging Modern JavaScript Frameworks - Second Edition Philip Japikse PDF All Chapters
com
https://ebookmeta.com/product/building-web-applications-
with-net-core-2-1-and-javascript-leveraging-modern-
javascript-frameworks-second-edition-philip-japikse/
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/javascript-frameworks-for-modern-web-
development-2nd-edition-sufyan-bin-uzayr/
ebookmeta.com
https://ebookmeta.com/product/javascript-frameworks-for-modern-web-
dev-1st-edition-tim-ambler-nicholas-cloud/
ebookmeta.com
https://ebookmeta.com/product/museum-of-the-profane-01-0-disabling-
relics-for-dummies-1st-edition-j-b-trepagnier/
ebookmeta.com
Peridale Cafe Cozy Mystery Box Set 4 Books 13 16 Agatha
Frost
https://ebookmeta.com/product/peridale-cafe-cozy-mystery-box-
set-4-books-13-16-agatha-frost/
ebookmeta.com
https://ebookmeta.com/product/basic-real-estate-and-property-law-for-
paralegals-7th-edition-jeffrey-a-helewitz/
ebookmeta.com
https://ebookmeta.com/product/the-art-of-body-talk-how-to-decode-
gestures-mannerisms-and-other-non-verbal-messages-gregory-hartley-
maryann-karinch/
ebookmeta.com
https://ebookmeta.com/product/don-t-judge-a-duke-by-his-cover-emily-e-
k-murdoch/
ebookmeta.com
https://ebookmeta.com/product/teaching-global-history-a-social-
studies-approach-2nd-edition-alan-j-singer/
ebookmeta.com
Private Selves Legal Personhood In European Privacy
Protection 1st Edition Susanna Lindroos-Hovinheimo
https://ebookmeta.com/product/private-selves-legal-personhood-in-
european-privacy-protection-1st-edition-susanna-lindroos-hovinheimo/
ebookmeta.com
Building Web Applications
with .NET Core 2.1 and
JavaScript
Leveraging Modern JavaScript Frameworks
—
Second Edition
—
Philip Japikse
Kevin Grossnicklaus
Ben Dewey
Building Web Applications
with .NET Core 2.1 and
JavaScript
Leveraging Modern JavaScript
Frameworks
Second Edition
Philip Japikse
Kevin Grossnicklaus
Ben Dewey
Building Web Applications with .NET Core 2.1 and JavaScript: Leveraging Modern
JavaScript Frameworks
Philip Japikse Kevin Grossnicklaus
West Chester, OH, USA Ellisville, MO, USA
Ben Dewey
Charleston, SC, USA
—Philip Japikse
Table of Contents
About the Authors���������������������������������������������������������������������������������������������������xix
Introduction�����������������������������������������������������������������������������������������������������������xxv
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
ix
Table of Contents
x
Table of Contents
xi
Table of Contents
Chapter 7: Build the Web Application with ASP.NET Core, Part 1������������������������� 271
Add the Additional NuGet Packages������������������������������������������������������������������������������������������ 271
ASP.NET Core Validation������������������������������������������������������������������������������������������������������������ 272
Custom Validation Attributes����������������������������������������������������������������������������������������������� 272
Format Client-Side Validation Errors����������������������������������������������������������������������������������� 281
Add the ViewModels������������������������������������������������������������������������������������������������������������������ 282
The AddToCartViewModel���������������������������������������������������������������������������������������������������� 282
The CartRecordViewModel�������������������������������������������������������������������������������������������������� 283
The CartViewModel������������������������������������������������������������������������������������������������������������� 283
The ProductViewModel�������������������������������������������������������������������������������������������������������� 284
Configure the Application���������������������������������������������������������������������������������������������������������� 284
The CustomerId������������������������������������������������������������������������������������������������������������������� 284
The ServiceSettings������������������������������������������������������������������������������������������������������������ 286
The API Service Wrapper����������������������������������������������������������������������������������������������������������� 290
The ISpyStoreServiceWrapper Interface������������������������������������������������������������������������������ 291
The SpyStoreServiceWrapper Class������������������������������������������������������������������������������������ 292
Add the SpyStoreServiceWrapper to the DI Container�������������������������������������������������������� 299
The Startup.cs File�������������������������������������������������������������������������������������������������������������������� 299
Update the Constructor������������������������������������������������������������������������������������������������������� 299
Remove the Routing Table Setup����������������������������������������������������������������������������������������� 300
Remove the Cookie Policy Options�������������������������������������������������������������������������������������� 300
Building the Controllers������������������������������������������������������������������������������������������������������������ 300
The Home Controller������������������������������������������������������������������������������������������������������������ 301
The ProductsController�������������������������������������������������������������������������������������������������������� 301
The Orders Controller���������������������������������������������������������������������������������������������������������� 306
The Cart Controller�������������������������������������������������������������������������������������������������������������� 308
Summary���������������������������������������������������������������������������������������������������������������������������������� 315
xii
Table of Contents
xiii
Table of Contents
WebOptimizer���������������������������������������������������������������������������������������������������������������������������� 346
Bundling and Minification���������������������������������������������������������������������������������������������������� 346
The WebOptimizer Solution������������������������������������������������������������������������������������������������� 347
The Layout and Login Views����������������������������������������������������������������������������������������������������� 352
The Images and CSS for the Application����������������������������������������������������������������������������� 352
The Layout View������������������������������������������������������������������������������������������������������������������ 352
The LoginView Partial View������������������������������������������������������������������������������������������������� 355
The Products Views������������������������������������������������������������������������������������������������������������������� 356
The ProductList View����������������������������������������������������������������������������������������������������������� 357
The ProductViewModel DisplayTemplate���������������������������������������������������������������������������� 358
Running the SpyStore Application��������������������������������������������������������������������������������������������� 359
The Add to Cart Views��������������������������������������������������������������������������������������������������������������� 359
The Add to Cart View����������������������������������������������������������������������������������������������������������� 360
The AddToCartViewModel Editor Template�������������������������������������������������������������������������� 361
The Cart Views�������������������������������������������������������������������������������������������������������������������������� 363
The Index View�������������������������������������������������������������������������������������������������������������������� 363
The Update Partial View������������������������������������������������������������������������������������������������������ 367
The Cart Record View Model Editor Template���������������������������������������������������������������������� 368
The Orders and OrderDetails Views������������������������������������������������������������������������������������������ 369
The Index View�������������������������������������������������������������������������������������������������������������������� 370
The Details View������������������������������������������������������������������������������������������������������������������ 371
Summary���������������������������������������������������������������������������������������������������������������������������������� 374
xiv
Table of Contents
xv
Table of Contents
Chapter 11: Building the Spy Store Web Application with Angular���������������������� 469
What’s Covered������������������������������������������������������������������������������������������������������������������������� 469
Create a New Visual Studio Core Project���������������������������������������������������������������������������������� 470
ASP.NET Project Files���������������������������������������������������������������������������������������������������������������� 472
Startup Class����������������������������������������������������������������������������������������������������������������������������� 472
Understanding App Component Setup�������������������������������������������������������������������������������������� 472
Understanding the Root index.html Page���������������������������������������������������������������������������� 473
Understanding the Root App Component����������������������������������������������������������������������������� 474
Understanding the App Module������������������������������������������������������������������������������������������� 475
Create Angular Bootstrap���������������������������������������������������������������������������������������������������� 476
Core Concepts��������������������������������������������������������������������������������������������������������������������������� 477
Application Initialization������������������������������������������������������������������������������������������������������ 478
Components������������������������������������������������������������������������������������������������������������������������ 479
Services������������������������������������������������������������������������������������������������������������������������������� 481
Templating��������������������������������������������������������������������������������������������������������������������������� 483
Routing�������������������������������������������������������������������������������������������������������������������������������� 488
Building the SpyStore Angular App������������������������������������������������������������������������������������������� 491
Add Routing������������������������������������������������������������������������������������������������������������������������� 492
Connecting to Services�������������������������������������������������������������������������������������������������������� 497
Route Parameters���������������������������������������������������������������������������������������������������������������� 503
Search Page������������������������������������������������������������������������������������������������������������������������ 505
Product Details Page����������������������������������������������������������������������������������������������������������� 510
Cart Page����������������������������������������������������������������������������������������������������������������������������� 517
Checkout����������������������������������������������������������������������������������������������������������������������������� 525
Summary���������������������������������������������������������������������������������������������������������������������������������� 527
xvi
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 601
xvii
About the Authors
Philip Japikse is an international speaker, Microsoft MVP,
ASPInsider, MCSD, PSM II, PSD, and CSM, and a passionate
member of the developer community. Phil has been working
with .NET since the first betas, developing software for over
35 years, and heavily involved in the agile community since
2005. Phil is coauthor of the best-selling C# and the .NET 4.6
Framework (http://bit.ly/pro_csharp) and Pro C# 7
(http://bit.ly/pro_csharp7), the Lead Director for the
Cincinnati .NET Users Group (www.cinnug.org), founded
the Cincy Deliver Conference (www.dayofagile.org), and
volunteers for the National Ski Patrol. During the day,
Phil works as the Director of Consulting and Chief Architect
for a boutique consultancy in Cincinnati. Phil always enjoys to learn new tech and is
always striving to improve his craft. You can follow him on Twitter via www.twitter.com/
skimedic and read his blog at www.skimedic.com/blog.
xix
About the Authors
xx
About the Technical Reviewer
Eric Potter is a software architect for Aptera Software
and a Microsoft MVP for Visual Studio and Development
Technologies. He works primarily in the .NET web platform,
but loves opportunities to try out other stacks. He has been
developing high-quality custom software solutions since
2001. At Aptera, he has successfully delivered solutions for
clients in a wide variety of industries. He loves to dabble in
new and exciting technologies. In his spare time, he loves to
tinker with Arduino projects. He fondly remembers what it
was like to develop software for the Palm OS. He has an amazing wife and five wonderful
children. He blogs at http://humbletoolsmith.com/, and you can follow him on Twitter
as @pottereric.
xxi
Acknowledgments
Philip Japikse: This first edition of this book could not have happened without the very
talented (and patient) team at Apress. The idea for this book started when .NET Core
was still called ASP.NET 5, and the ride from ASP.NET 5 to Visual Studio 2017 has been
an interesting one, to say the least. This book also couldn’t have happened without my
loving wife, Amy, and all of the time she spent copyediting for me (for free) to keep my
words from being a jumbled mess. I also want to thank my coauthors for all of their
hard work. The goal of this book is to cover multiple technologies, and without their
dedication to the cause, this book would have died a long time ago. Finally, I have to
thank my children for their patience and understanding. Now that we are done, we can
get out on the slopes and make a few turns!
Kevin Grossnicklaus: First, I’d like to express my extreme gratitude to Phil and Ben
for the opportunity to be a part of this book at all. It has been a lot of fun and something I
am honored to be a part of. An equally large thank you goes out to the team at Apress for
being patient and helping pull everything together. Writing about technologies during
their beta cycle is always challenging, and getting three authors (including a chronically
slow one like myself ) to the finish line deserves some type of medal. Next, a shoutout
to my team at ArchitectNow for pushing me to keep on top of technology just as much
now as I did early in my career. I am constantly amazed at all the cool technologies and
products we get to use on a daily basis. That said, who knew we would be writing this
much JavaScript in 2017? Finally, to my awesome wife, Lynda, and my three beautiful
daughters, Alexis, Emily, and Hanna, thanks for putting up with all the time I spend
working, writing, or with all my other random hobbies. I love you all very much!
Ben Dewey: I’d like to thank a number of people who made this book happen. When
Phil came to me with the dream to create a book for .NET developers and architects
that would help navigate the real-world challenges and decisions that teams need to
make, I was all in. His vision and direction helped shape the complete story that we
delivered in this book. I’d also like to thank Apress and their wonderful team for their
help and guidance while we chased the changes and releases of Visual Studio 2017
xxiii
Acknowledgments
xxiv
Introduction
The idea for this book came out of a discussion among conference speakers about the
problem with keeping up with technology. Not only the rapid fire and revolutionary
changes in the .NET ecosystem but also the proliferation of JavaScript frameworks.
I stated to the group:
“There needs to be a book designed to get someone up to speed on ASP.NET 5
and help them make informed decisions about which JavaScript framework (if any)
to use. The problem is that the material on the popular JavaScript frameworks is too
comprehensive. We need to have a book that gives enough information to enable
informed decisions without having to invest weeks learning a framework that might not
be a fit. Following the fail fast mantra from lean.”
A silence fell over the group. They all looked at me and said, “Great idea! When are
you going to write it?”
Thus, the first edition of this book was born, at least in concept. While I knew I
could handle the .NET Core part of the book, I was really a customer for the second half
of this book, having little exposure (at the time) to the modern JavaScript frameworks.
I reached out to two of my long-time friends, Ben and Kevin, and asked them if they
would be interested in authoring the second half of this book. I knew they are deeply
immersed in many of the JavaScript frameworks and would be a great match to round
out the writing team.
This edition covers .NET Core 2.1, which is the current LTS version of .NET Core.
This is also the version of .NET Core that still works with the .NET Framework.
xxv
Introduction
xxvi
Introduction
The site is also responsive, and it will alter its UI based on the view port. Figure 3
shows the home page as viewed on a mobile device.
xxvii
Introduction
xxviii
Introduction
xxix
Introduction
xxx
Introduction
xxxi
Introduction