
Explore a comprehensive ASP.NET Core MVC guide, building CRUD apps with MVC and Razor pages, implementing identity and authentication, plus Entity Framework Core, repository pattern, and Azure e-commerce deployment.
Explore building a book e-commerce app hosted on Azure, with admin content management, product CRUD, tiered pricing, Stripe payments, company net-30 orders, and email via SendGrid or SMTP.
Explore the essential tools for this course, including dotnet six, visual studio 2022, and sql server management studio, with compatibility for older sql server versions.
Access project resources in Dotnet Mastery, including live preview of the final website, GitHub code with section updates, templates, and downloadable course content, snippets, and PowerPoint attachments.
Explore the evolution of dotnet core from web forms and mvc to a cross-platform, cloud-friendly framework, with built-in dependency injection, rapid upgrades, and performance-driven improvements.
Explore how dependency injection in ASP.Net Core uses a built-in container to supply interfaces like email and database access to pages, eliminating duplicated object creation and simplifying future changes.
Create an ASP.NET Core MVC project in Visual Studio 2022 using model–view–controller template with C#, set solution and project names, target dotnet 6, enable https, and omit authentication and docker.
See how hot reload in dotnet 6 instantly updates the UI from saved changes in mvc or razor views, and learn when razor runtime compilation or nuget packages are needed.
Examine the csproj project file for a dotnet six app, noting the target framework, item group, and NuGet packages as you prepare database connections and entity framework usage.
Navigate launch settings with bulky book web and IIS express profiles on ports 5000 and 5001; manage static files in wwwroot and secrets in appsettings.json for development, staging, production.
Registers services in program.cs with a web application builder, adds MVC controllers with views, and configures the middleware pipeline with authentication, authorization, routing, and error handling.
Explore mvc architecture basics by examining models, views, and controllers, and learn routing, action methods, and how the controller interfaces between model and view to process requests and render output.
Explore routing in mvc: map urls to controller, action, and optional id, with a default route to home/index. See examples and practice identifying controller, action, and id from sample urls.
Master routing in MVC by mapping urls to a controller and its actions, then loading the corresponding view from the views folder.
Learn how default views work in a .NET Core project, including the shared partial views and the underscored layout as the master page with render body and tag helpers.
Tag helpers in ASP.NET Core provide server-side rendering, inspired by Angular directives, with a tag-like, user-friendly approach using asp- attributes to simplify forms and labels.
Understand how IActionResult serves as a unifying return type in MVC and Razor Pages, enabling view, redirect, or Json results while supporting page and content results.
Create a category model for SQL Server using .NET Core and Entity Framework Core, including ID, name, display order, and CreatedDateTime with default value and data annotations.
Apply the key and required data annotations to define a primary key identity column and a non-null name, while EF Core generates the corresponding database script.
Add a connection string in appsettings.json for a .NET core project using SQL Server, with a trusted connection and environment-specific settings.
Define an application db context to connect to SQL Server using a connection string, configure entity framework core, and add a category dbset mapping to the categories table.
Add the DbContext as a service in Program.cs and configure it to use SQL Server with the default connection string from appsettings.json.
Create the database and categories table using entity framework code first, and manage changes with migrations. Install entity framework tools, add a migration, and apply update database to push changes.
Create a category controller in .NET Core, add an index action and corresponding Razor view, and learn to scaffold views for create, edit, and delete.
Learn to retrieve all categories from the database using EF Core and dependency injection, populate the category list from the application DB context, and display them in the index view.
Pass an enumerable of category to a razor view and capture it with the model, then render a table showing category name and display order with a for each loop.
Apply the Bootstrap 5 theme from Bootswatch by replacing the CSS and JS, enable razor runtime compilation, and update the layout and navigation to a dark Bootswatch look.
Set up a two-column bootstrap layout with a create category button linked to category controller's create action, integrate bootstrap icons and getbootstrap icons CDN, and ensure the create action exists.
Create a category view using Razor and tag helpers to bind a category model, collect name and display order, post to create, and navigate back to the list.
Demonstrates creating a category through a post action in the category controller, validating anti-forgery tokens, saving via db context, and redirecting to index, with a note on not-null name validation.
Learn to implement server-side validations in .NET Core by validating models in the controller, using model state, and displaying validation messages with tag helpers and bootstrap styling.
Explore server-side validations with a top-of-page summary via ASP validation summary, implement custom model errors (name vs display order), and display errors at the top and in fields.
Enable client side validation by including the validation scripts partial (jQuery.validate) in the view, adding a script section, and verify client checks run before server side validation during category creation.
Explore client-side validations in dotnet core, using display name and the range attribute with min and max values, to apply inline, customizable error messages for a category form.
Implement edit functionality in the category controller: load a category by id using find, single or default, or first or default; validate id and display an edit view to update.
Learn to edit categories using EF Core's DbSet update, with validations, saving changes, and redirecting to index, then implement delete flow with a details page and disabled fields for confirmation.
Consolidate delete category functionality in a .NET core app by handling get and post actions, retrieving by id, removing the category, saving changes, and redirecting to index.
Display one-request alerts after create, edit, or delete by using temp data to store a 'success' message and render it globally with a partial view.
Create a partial in a shared folder named _notification to display alerts across pages, using temp data for both success and error messages in a Razor view.
Implement toaster alerts with the toaster js library by adding its css and js, including jQuery, and wiring toaster.success and toaster.warning in the underscored layout for all pages.
Scaffold an mvc controller with views using Entity Framework to provide full CRUD for the category model, including create, edit, delete, details, and index views, then deploy to Azure.
Learn Razor pages as an alternative to mvc by building a small crud application, and understand how identity authentication and authorization integrate with the built in identity razor class library.
Create a Razor pages ASP.NET Core web app in Visual Studio 2022 with .NET 6, name the project API, set the solution API, and open Solution Explorer.
Contrast mvc with the setup, showing no model–view–controller folders and a pages folder with razor pages; appsettings.json, program.cs, and wwwroot stay the same. The next video walks through the pages.
Discover Razor Pages, introduced in ASP.NET Core 2.0, which isolate each page with a page model to simplify page-focused coding while delivering MVC features like routing, models, and tag helpers.
Master default Razor views by examining the underscored layout as the master page with header and footer, rendering index and privacy content.
Discover how Razor pages map URLs to physical files using the pages folder and default index.cshtml, with practical examples like privacy and account routing.
Create a category model using Entity Framework Core code first, defining id as identity, name, and display order to map to a SQL Server table.
Discover how data annotations in entity framework core define primary keys, identity columns, and required fields for tables. Configure a connection string and NuGet packages to create the database.
Configures a sql server connection string in appsettings.json and uses the default connection block. Demonstrates environment-specific settings, localhost connectivity, and preparing the db context for EF Core.
Install entity framework core and sql server packages, create an application DbContext with a category DbSet, and configure it to use the connection string from appsettings.json.
Configure the db context as a service in program.cs, use sql server with the connection string from appsettings.json via the default connection key, enabling dependency injection.
Create and migrate a sql server database using Entity Framework Core, add a migration for category, resolve missing NuGet package, and apply updates to generate category table and migration history.
Create a Razor page under categories to display all categories, wiring up EF Core with a registered DbContext and dependency injection to retrieve the list.
Display all categories on the razor page by iterating the model's categories and rendering a bootstrap table with name and display order.
Reset the category data by deleting the category record, verify a clean state, then add a create category button that links to a new razor page under the categories folder.
Add a new razor page named create in the categories folder, using a create model and a post form with name and display order, styled with Bootstrap.
Bind a ui to a model in Razor pages by creating a category property in the create model, binding inputs with tag helpers, and handling post requests to fetch data.
Create a post handler in Razor pages to add a category via the application db context with bind property, then use async add and SaveChangesAsync and redirect to index.
Apply boot swatch themes to a .NET Core app by updating bootstrap CSS, JS references, and icons, then style dark navigation, borders, and text; address null value validation.
Implement server-side validations for category creation using ModelState.IsValid to create only when the model state is valid. Display errors with asp-validation-for in cshtml, category.name and display order, styled with text-danger.
Implement custom server-side validation by adding a model error when category name equals the display order, and show it with a validation summary.
Learn how to customize display names using the display attribute and apply the range data annotation to enforce display order between 1 and 100, with custom error messages.
Enable client side validations in a .NET Core app by including the shared validation scripts partial. Bind custom model state errors by key name.
Add edit and delete actions to the categories index, wiring links with tag helpers to pass the category id and style with Bootstrap btn classes and icons.
Learn to build and debug an edit category page in razor pages, including model naming, retrieving by id with find or first or default, and updating via db set update.
Debug the edit action to fix updating an existing category by binding the id with a hidden asp-for field, preventing Entity Framework from treating it as a new object.
Implement delete category by locating the category by id, removing it from the database, saving changes, and redirecting to index, with a disabled delete view and validation handling.
Store one-time success messages in temp data before redirects, then retrieve and display them on the index page using razor syntax to show alerts that disappear after refresh.
Explore implementing toaster notifications in a .NET Core app by adding toaster CSS and JS, wiring in jQuery, and displaying success or error messages via temp data.
Learn to use partial views in asp.net core razor to centralize alert code in the shared folder, call the underscore notification partial from pages, and update in one place.
Scaffold create, read, update, and delete pages using entity framework by selecting a model and DbContext to auto generate the operations; run and navigate to validate categories.
Switch back to the bulky book project to enhance your first application after mastering basic CRUD operations with Razor Pages.
Divide the bulky book solution into separate class library projects: data access, models, and utility, using dotnet six to support drastic growth.
Explore n-tier architecture by reorganizing a .NET solution into data access and models projects, centralizing constants in a static St class, updating namespaces, and resolving EF Core migrations and usings.
Display product details on the details page, use a details action to fetch one product, and add a shopping cart view model with a count validated 1-1000.
Recover from corrupted migrations in entity framework core by deleting the migrations folder and database, then recreating migrations and updating the database, for learning.
Switch to the flatly Bootswatch theme by applying bootstrap.css, customize the layout with a primary background, remove the search bar, and create book categories: fiction, romance, action, fantasy.
Explore the repository pattern to abstract data with a collection-like interface for add, remove, update, and select, enabling loose coupling and persistence ignorance.
Explore an in-memory repository pattern with add, remove, get by id, and get all by parameters, noting no update in the repository and the role of unit of work.
Explore how the unit of work coordinates multiple repositories via a shared db context and saves changes in one transaction, and compare it with db set and repository pattern benefits.
Implement a generic repository interface with methods like get, get all, add, remove, and first or default, then define I category repository and unit of work with a db context.
Implement a generic repository pattern for data access by defining the Irepository<T> interface with methods to get all, add, get first or default by filter, and remove or remove range.
Implement a generic repository (Irepository) using a public class binding to DbSet<T> via the application db context, providing add, get all, get first or default, remove, and remove range.
Create a public category repository that implements the generic repository, define the ICategoryRepository interface, and implement get all, update, and save methods for category data.
Implement the category repository by wiring the interface to the generic repository, inject the application db context, and expose update, get first or default, get all, add, remove, and save.
Replace the application db context with the category repository by registering it as scoped, and use the repository to perform CRUD operations with save changes.
Implement a unit of work to centralize save changes across repositories, expose a global save method, and wire the category repository via dependency injection in the bulky book web project.
Register unit of work in dependency injection and replace the category repository; one unit of work now manages all repositories with a single global save.
Create a cover type model with id (primary key) and name (required), apply migrations to build table, and implement a cover type repository and interface within the unit of work.
Create a cover type model with id and name, add db set and migration, then implement a cover type repository and unit of work for create, read, update, and delete.
Learn to create admin and customer areas in a .NET Core project using scaffolding, with area routing configured in Program.cs.
Organize by moving controllers and views into admin and customer areas, add per-area view starts and imports, and use the asp-area tag helper to navigate areas in .NET 6.
Create a cover type controller with crud actions (create, edit, delete, index) and views, mirroring the category workflow while implementing client and server side validations in the mvc architecture.
Copy the category controller as the cover type controller, implement full CRUD for cover types, update views and layout, and verify operations with the new unit of work repository.
Uncomment and refine navigation dropdown labeled cms (content management system), apply dropdown item classes to anchor tags, and define the customer area to fix home routing and ensure navigation works.
Create a product model for content management, including id, title, isbn, author, list price, final price, and bulk pricing for 50+ and 100+ books, with category and cover type relations.
Create a product model, add a products dbset in the application db context, and apply migrations to update the database. Observe foreign-key mapping for category ID and cover type ID.
Implement a product repository by copying the cover type repo, enable selective updates with entity framework core, and conditionally update image URL in the unit of work.
Create a product controller and views in the admin area, reuse the cover type layout, and implement a single upsert action with data loaded via API calls.
Learn to implement upsert in the product controller using a single get/post action to create or update by ID, and add category and cover type dropdowns to the view.
Apply LINQ projections to convert category and cover type repositories into select list items, exposing text and value for dropdowns in an ASP.NET Core MVC controller.
Pass dropdown data from the controller to the view with ViewBag in .NET Core, using a dynamic per-request store to populate category lists and bind category id dropdown via asp-items.
Explore view data, view bag, and view back in .NET core: pass data from controller to view, type casting, scope limits, and temp data for one-time messages.
Create a dedicated product view model to tightly bind the view to a model, replacing view bag and view data, with properties for product, category list, and cover type list.
Learn how to add a file upload to a product form using multipart form data and IFormFile, then apply image input handling in the product controller.
Implement dynamic product forms that switch between create and update based on product id, and enforce image upload on create using sweet alerts for validation.
Create first product by validating model state, uploading the image to wwwroot/images/products, saving a unique file name, updating the product image URL, and persisting the product.
Display all products with data tables dot net, enabling sorting, pagination, and search, by building a get all API endpoint that returns JSON from product data via unit of work.
Load product data into a data table via ajax using product.js, map columns (title, isbn, price, author, category), and debug case sensitivity and null category issues.
Learn how to auto-populate a product's category with Entity Framework Core include statements, extend the repository to handle comma-separated include properties, and render category data in the data table.
Render html buttons in the data table to edit or delete a product, passing the product id in the url; ensure the edit page uses the id to populate details.
Load product on upsert by querying with the provided id using unit of work, avoid loading foreign keys, and update display names for category, cover type, and price fields.
Validate model state, update product image by deleting existing image file if the image URL exists, upload the new image, and ensure updates are performed instead of creating records.
Update book images by binding the product id with a hidden field to enable updates, ensure image url posts, replace images, and adjust the ui layout to display the image.
Implement a http delete api endpoint to remove a product by id, delete its image, and return a json success message with sweet alert and toaster notifications.
Implement a delete function that confirms with a sweet alert, sends an Ajax delete request to the product endpoint, shows toaster messages, and reloads the data table on success.
Integrate TinyMCE rich text editor into product descriptions by adding the script tag, API key, and initialization code to your upsert form, enabling a textarea to render the editor.
Display all products on the home page by fetching them with the unit of work, including category and cover type, and render a grid with images, titles, and prices.
Apply the Lux theme to the home page by downloading and pasting the boot swatch CSS, and plan the details page as an action method in the home controller.
Show a single product on the details page. Build a shopping cart view model with the product and a count defaulted to one, validated 1 to 1000.
Build a details UI in a .NET 6 app by adding a razor view, configuring the model and view model, and displaying product details with price, image, and add-to-cart.
Resolve scaffold identity failures in dotnet 6 by updating all NuGet packages and using a dummy project workaround to copy identity files and enable authentication.
scaffold asp.net core identity with razor pages using the identity class library, configure the application db context, and enable login, registration, and cart persistence via ef core.
Scaffolding identity adds default identity services and entity framework stores to program.cs, includes use authentication middleware and identity razor pages with login partials for layout.
Configure and migrate ASP.NET Identity tables by adding a migration and updating the database, ensure Razor pages route for register and login, and map Razor pages in Program.cs.
Explain why scaffolded identity registration fails due to a non-null return URL in dotnet 6. Make the return URL nullable in register and login handlers to fix model state.
Register and login work, creating the first user, signing in, and displaying a logout option while planning to extend the identity user with roles and extra properties.
Extend the identity user by creating an application user class with properties like name, address, city, state, and postal code, add a DbSet, run migrations, and understand discriminator usage.
Create a company model with id, name, address and phone, then implement repository and unit of work to perform CRUD using data tables and include update and edit actions.
Create a public company model with key fields, register it in the dbcontext, and implement a repository and unit of work to enable CRUD operations via a controller.
Assign roles to multiple users (employees, admins, customers, and company customers) during registration by enabling a custom identity with role support and email confirmation tokens.
Seed four roles, admin, employee, individual users, and company, using a role manager with identity roles and existence checks, addressing email sender dependency with a fake implementation.
Enhance the register UI by adding name, address, phone number, and a roles dropdown, wiring these properties to the application user and updating the Razor Pages register page and model.
Display a dropdown of all roles by loading an IEnumerable<SelectListItem> from the database and projecting role names for the register page, binding the selection to the input model.
Register users and assign the selected role using the user manager; default to the end customer role if none chosen, and verify role mappings.
Add a nullable company id to the ASP.NET user as a company foreign key, migrate database, and populate the register dropdown with company names and ids via unit of work.
Toggle the company dropdown visibility with jQuery by reacting to the roles dropdown change event, showing or hiding the company field based on the selected option, using document.ready.
Assign the company ID to a user when the role is company by mapping input.companyID to user.companyID in the ASP.NET users table, then verify by registering a company user.
Add a shopping cart table to the database by storing signed-in user ID, product ID, and quantity with proper foreign keys, then create a db set and run migrations.
Create and connect a shopping cart repository and an application user repository, implement their interfaces, and update the unit of work to include both.
Add items to the shopping cart via a secured post in dotnet core, requiring login, capturing product id and count, assigning the user id from claims, and redirecting to home.
Learn to add items to a shopping cart by retrieving the existing user and product entry, updating the count via the cart repository, and saving changes with unit of work.
Configure the application cookie in program.cs to customize login, logout, and access denied paths for identity, ensuring proper redirects for unauthenticated users.
Create a shopping cart page by adding a cart link and icon to the customer area, and implement a cart controller index action and index view.
implement a shopping cart view model and retrieve user-specific cart items via a unit of work and repository, with controller level authorization and product data included.
Modify the shopping cart to calculate item prices based on quantity using a get price based on quantity function, and display a grand total in the index view.
Add a cart total property, compute it as price times count in the cart controller, convert to currency, and display it in the shopping cart view.
Update shopping cart quantities by passing the cart ID through ASP actions for plus, minus, and remove, incrementing or decrementing counts and saving changes to the database.
Create a cart summary UI by adding a summary action and view, showing shipping details and the order total, and design two tables: header and details.
Create order header and order detail models with keys, user linkage, date fields, totals, statuses, tracking and Stripe payment IDs, and address data, then migrate to the database.
Implement the order header and order detail repositories, extend the unit of work, and add update logic for order and payment statuses with a nullable payment status.
Configure the summary get action to populate the shopping cart view model with order header data, including name and cart total, by retrieving the logged-in user via unit of work.
Load the cart summary UI by binding order header details to the view model, using asp-action and validation, and render cart items with currency formatting and an estimated arrival date.
Load the cart from the database, create the order header and details with unit of work, set pending statuses, save changes, clear the cart, and redirect to home index.
Debug and implement order placement by binding the shopping cart view model, post actions, and persisting the order header and details to the database to create the first order.
Integrate Stripe payments by creating a Stripe account, obtaining publishable and secret keys, and securely configuring your app to store and access them in development.
Bind the Stripe section in appsettings.json to a Stripe settings class and configure the secret and publishable keys in the pipeline, then inject these settings into the view.
Configure Stripe checkout by installing Stripe.Net, building a session with cart line items, converting prices to cents, and redirecting to Stripe checkout with success and cancel URLs.
After payment, redirect to order confirmation and save the Stripe session ID and payment intent ID on the order header to verify payment status via the repository.
Finalize the order confirmation by validating payment via the session, updating order and payment statuses to approved, clearing the shopping cart, and showing the order number on the confirmation view.
Test Stripe in action by placing an order, creating a session and payment intent, using Stripe test cards, confirming payment, and updating the order to approved before showing order confirmation.
Test Stripe in action by placing a test order, observing Stripe session creation and payment intent, updating the order header, and confirming the payment redirects to the order confirmation.
This is a Beginner to Advanced level course on .NET 6 that will take you from basics all the way to advance mode. This course is for anyone who is new to ASP.NET Core or who is familiar with ASP.NET and wants to take the first stab at understanding what is different in ASP.NET Core. From there we would be building multiple projects to understand all concepts in .NET 6 as we will deploy our final application on Azure as well as IIS.
Throughout this course, we would understand the evolution of ASP.NET Core, and then we would take a look at the modified files and folder structure.
We would then take a look at new concepts in ASP.NET Core
We would build a small Razor application with CRUD operations using Entity framework for integration with the database.
We would build our Bulky Book website where we will learn advanced topics in ASP.NET MVC Core
Finally, we will deploy our Bulky Book website on Microsoft Azure and IIS.
What are the requirements?
3-6 months knowledge of c#
Visual Studio 2022
SQL Server Management Studio
What am I going to get from this course?
Learn the structure of ASP NET MVC Core Project
Learn the structure of ASP NET Core Razor Project
Learn the fundamentals of ASP NET MVC Core
Build 2 Projects throughout the course
Integrate Identity Framework and learn how to add more fields to Users
Interact with Razor class library for Identity
Integrate Entity Framework along with code first migrations
Sessions in ASP NET Core
Custom Tag Helpers in ASP NET Core
Bootstrap v5
Authentication and Authorization in ASP NET Core
Email notifications
TempData/ViewBag/ViewData in ASP NET Core
Stripe Payment Integrations
Repository Pattern to Access Database
Seed Database Migrations Automatically
Deploying the website on Microsoft Azure