
Discover the complete guide to ASP.NET Core Razor Pages, from building a basic CRUD project to a real-world .NET 6 app with entity framework core, authentication, and deployment.
Build a restaurant web app with ASP.NET Core Razor Pages on Azure, featuring a browsable menu, shopping cart, Stripe checkout, and admin tools for items, roles, and orders.
Explore the tools needed for this course, including dotnet six, Visual Studio 2022, and SQL Server Management Studio for the database.
Find all project resources at dotnet mastery, including a live site preview, sectioned GitHub updates, and downloadable course content with snippets, PowerPoint files, and attachments.
Trace the evolution of dotnet core, from web forms and mvc to a cross-platform, cloud-friendly, fast, open-source framework with built-in dependency injection and smooth upgrades.
Discover how dependency injection in ASP.NET Core uses the built-in IOC container to inject services via constructors, reducing duplication and simplifying maintenance across pages.
See how hot reload in dotnet six automatically updates Razor Pages on save, reflecting changes without refreshing. If needed, install the Razor runtime compilation package and enable it in Program.cs.
Explore how Razor Pages in ASP.NET Core offer page and page model isolation, enabling routing, models, action results, and tag helpers with the same capabilities as MVC.
Open the project file in the asp.net core razor pages course to view the property group setting dotnet six and the item group for nuget packages, including razor runtime compilation.
Configure launchsettings profiles for IIS Express and local run, including ports 44317 and 5001; manage static files in wwwroot and use environment-specific appsettings.json variants.
Explore how program.cs configures the web application using a builder, registers services like razor pages, and builds a middleware pipeline with routing, authentication, and authorization.
Explore routing in Razor Pages by mapping URLs to physical files inside the pages folder, using index.cshtml as the default page and direct mappings for privacy and account paths.
Explore Razor Pages' default layout with an underscored master page, header, footer, and render body. Understand partial views, view imports, tag helpers, and on get and on post handlers.
Learn how tag helpers in ASP.NET Core enable server-side rendering, replacing HTML helpers with a tag-based approach that simplifies forms and labels, and diverges from client-side Angular directives.
Explain how IActionResult acts as a parent type for many derived classes in MVC and Razor pages, enabling flexible returns like view, page, and redirects.
Create a category model for a code-first EF Core setup, defining an identity primary key, a name, and a display order in a new model folder for SQL Server.
Explore how data annotations configure primary keys, identity columns, and required fields in Entity Framework Core, and set up a SQL Server connection string with EF Core packages.
Add a connection string in appsettings.json under connectionStrings, using the dot as server name for the AP database and trusted; then configure the db context and EF Core.
Install entity framework core and sql server packages, then create an application dbcontext and a category dbset. Configure the connection string in appsettings.json to connect to your database.
Configure the application to use a SQL Server DbContext by registering it as a service in program.cs, retrieving the default connection string from appsettings.json and wiring it through dependency injection.
Configure the SQL Server connection and create the database using EF Core migrations; add a migration named add category to db and run update database to generate the category table.
Create a dedicated categories index page in Razor Pages, wire up dependency injection and entity framework core with the application db context to fetch all categories and display them.
Display all categories on the Razor page by looping model.categories in index.cshtml. Present them in a Bootstrap-styled table with name and display order, using Razor runtime compilation.
Create a new razor page under the categories folder to build a create category form with name and display order, submitted via post.
Bind a form to a category model in a Razor Pages create page using tag helpers and asp-for to bind name and display order, then post to process submitted data.
Create a post handler in Razor pages to add a category. Use bind property and class-level bind properties to streamline category input and binding to the UI.
Apply Bootswatch themes to customize Bootstrap styling, update the CSS and layout, and enable dark navigation and icons. Add input validations to prevent null values and avoid exceptions.
Learn server-side validations in asp.net core razor pages by validating category model on create using model state and is valid, and show errors via asp-validation-for for name and display order.
Implement server-side custom validations in ASP.NET Core Razor Pages by comparing category name and display order, adding a model error with ModelState.AddModelError, and displaying a validation summary.
Learn how to customize field names with the display attribute and enforce value ranges with the range data annotation in Razor Pages, including custom error messages for display order.
Learn to enable client side validations in ASP.NET Core Razor Pages using a shared validation script partial, a scripts section, and partial tag helper to bind errors to a property.
Add edit and delete links to the categories index using tag helpers and routes, pass the category id, and style with bootstrap to navigate to dedicated edit and delete pages.
Create and reuse a razor page for editing a category by renaming the model and retrieving the category by id. Update it with the db set update method.
Debug and fix the edit operation in ASP.NET Core Razor Pages by binding the category ID with a hidden field to prevent creating a new object.
Implement delete category functionality in asp.net core razor pages by locating the category by id, removing it from the database, saving changes, and redirecting to index with disabled fields.
Discover how to use TempData in ASP.NET Core Razor Pages to show one-request alerts on the index page after create, edit, or delete actions.
Add toaster notifications to a Razor Pages app by including toaster CSS and JS, wiring jQuery, and triggering toaster.success with temp data for success and error messages.
Move alert code into a partial view to avoid duplicating code, call it from pages, and optionally render it in the shared layout for consistency across all pages.
Learn how to scaffold Razor Pages for CRUD operations with Entity Framework in ASP.NET Core, generating create, read, update, delete pages under a category temp folder using a DbContext.
Divide your ASP.NET Core Razor Pages solution into data access, models, and utilities by creating three class library projects, moving data, and updating to .NET 6 RC1.
Move models and data files into their respective projects, update namespaces, and resolve build errors. Start fresh by deleting migrations and the database, then re-create migrations.
Fixing IIS Express errors by correcting using statements and references in an n-tier architecture, creating a fresh database via EF Core migrations, and updating packages to .NET 6.
Organize admin and customer pages by creating folders, moving categories into admin, and updating namespaces in page models and views; restart Visual Studio to refresh navigation and test a category.
Add a dropdown in the navbar under admin to manage categories, applying the Lux light theme in underscore layout and converting the dark navigation to primary.
practice CRUD for a new food type model with id and name in an n-tier asp.net core razor pages project, with client and server side validations and copied views.
Create and integrate a food type model in an ASP.NET Core Razor Pages app, add a DbSet, remove display order, run migrations, and implement CRUD across food type pages.
Explore the repository pattern in a dotnet razor pages app, using a generic interface with dependency injection to add, remove range, get all, and get first or default.
Implement a generic repository in ASP.NET Core Razor Pages by wiring the application db context, binding a db set, and adding, removing, and querying all or first-or-default records.
Implement a category repository atop a generic repository, adding update and save changes via dependency injected application db context, and use entity framework core tracking to selectively update properties.
Register the category repository in the dependency injection container in program.cs for ASP.NET Core Razor Pages, explain service lifetimes (singleton, scoped, transient) and use ICategoryRepository for database access.
Explore implementing a category repository with dependency injection, replacing direct db context usage with repository methods like add and get all, and introduce a unit of work to encapsulate saves.
Implement a unit of work that implements IDisposable to wrap all repositories, exposing a category repository and a save method, using a DbContext with dependency injection.
Demonstrates wiring the unit of work into the container via dependency injection and using the category repository to perform CRUD operations in razor pages.
Create the food type repository interface and implementation, configure it in the unit of work, and update pages to use the unit of work instead of the application db context.
Implement the food type repository and its interface, wire it into a unit of work, and enable crud operations via dependency injection in the food type pages.
Create a menu item model with ID, name, description, image URL, and price validated between 1 and 1000; implement foreign keys to food type and category with navigation properties.
Create a menu item table by adding a migration, configuring a db set in the app db context, and pushing changes with foreign key constraints and indices.
Configure the menu item repository and update the unit of work to include the new menu item, aligning updates to only change provided properties and preserving existing image when null.
Explore ASP.NET Core Razor Pages admin menu items index using data tables and an API call, with a single upsert page handling both create and update.
Build a menu item upsert page with a Razor Pages get handler, enabling create and update flows, and handling image uploads with multipart form data using a unit of work.
Populate category and food type dropdowns on menu item upsert page using a get handler and unit of work, binding to the page model and rendering via select tag helpers.
Integrate a rich text editor using TinyMCE in an ASP.NET Razor Pages app, wiring in the script, API key, and a textarea with validation for create and upsert flows.
Learn to implement a menu item post handler: upload an image to wwwroot/images/menu items, generate a unique file name, and persist the item with unit of work save.
Add an api endpoint in the Razor project to fetch all menu items as json via a controller, and display category and food type names on the index page.
Use include to load category and food type in EF Core. Extend the repository to accept comma-separated include properties and display results in a data table.
Include data tables in the project by adding CSS and JavaScript and wiring a dt_load table with data tables. Load data via the API endpoint with sorting, pagination, and search.
Load a data table via an ajax get request to /api/menu item, define columns for name and price, and ensure case sensitive handling for category and food type responses.
Render edit and delete buttons in a data table using the menu item ID to navigate to the admin menu items absurd page for editing, with Bootstrap styles and icons.
Learn how the menu item edit get handler loads item details from the database, populates dropdowns, and switches the form to update mode with image display for existing items.
Implement the update flow for a menu item in asp.net core razor pages, including fetch, optional image replacement with old image deletion, and saving changes.
Implement an http delete endpoint for menu items with sweet alerts approval, remove the item via unit of work, save changes, and delete its image from the web root.
Implement delete menu item with a sweet alert confirmation, call the api delete endpoint via ajax, and refresh the data table with toaster notifications.
Display all menu items on the home page with a bootstrap card layout and a get handler. Use dependency injection and a unit of work to fetch items and categories.
Display home page renders categories and their menu items by looping through category list and filtering menu items with a where clause. It shows price, image, and HTML raw descriptions.
Extend the repository with include properties, nullable includes, and a shared filter for get all and get first or default, plus a configurable order by.
Navigate to the details page using the item id, load the menu item via the unit of work, and display category, food type, price, bound count, and client-side validation.
Learn how to use a per-page view model to scale Razor Pages and save shopping cart data to the database with user id, menu item id, and count, using Identity.
Scaffold identity into an existing dotnet core web project, override the identity files, and connect to the application db context, ensuring all nuget package versions align.
Register the first user by scaffolding identity, applying migrations, and updating the database; adjust the register page to allow a nullable return URL and sign in upon success.
Extend the identity user by adding first name and last name in an application user, migrate and update the ASP.NET users table, and standardize all usage to application user.
Extend the registration flow to create an application user with first name, last name, and phone number, replacing identity user and updating the input model.
Configure and seed multiple roles in ASP.NET Core Razor Pages by defining role constants, creating roles with the role manager, and assigning selected roles to new users during registration.
Configure ASP.NET Core Razor Pages to support roles by switching to custom identity, adding role management, a fake email sender, and default token providers, then assign roles to users.
Create a shopping cart repository by adapting the existing category repository, updating the interface, removing the update logic, and wiring it into the unit of work for later extension.
Bind a shopping cart object on the details page with the menu item, count, and user ID, and create a cart entry when the add to cart button is pressed.
Explore how authorization restricts access in ASP.NET Core Razor Pages using the authorize attribute at the page model level and configure custom login, logout, and access denied paths.
Implement add to cart on ASP.NET Core Razor Pages by capturing menu item id, user id from claims, and quantity, validating model state, and saving to the shopping cart.
Increment the shopping cart count for an existing item instead of creating duplicates. Implement repository methods to increment and decrement counts, with unit of work handling updates.
Create a shopping cart page in ASP.NET Core Razor Pages with a get handler that displays all carts for the logged-in user using unit of work, claims identity, and authorization.
Learn to implement a shopping cart in asp.net core razor pages, display items with image, name, category, price, and quantity, and fix data population for authorized users.
Learn how to load navigation properties for a shopping cart in ASP.NET Core Razor Pages using include properties and then include to load menu item, category, and food type.
Calculate the cart total by summing price times count for each item and display it in the cart view; illustrate routing from cart to customer home index using relative path.
Implement three post handlers (plus, minus, remove) for the shopping cart using asp-page-handler tag helper and a cart ID; fetch the cart, adjust the count, and redirect to index page.
Implement remove and decrement logic for shopping cart items in a Razor Pages app, saving with unit of work and showing 'please add items to the shopping cart' when empty.
Build a cart summary UI with Razor Pages, capture name, phone, pickup date and instructions, display the order items, and redirect to Stripe for payment.
Create the order header model with id, user id, date, total, pickup time, and status. Add data annotations for validation and currency formatting, and map dates for ef core.
Create the order details model with an order header id as a foreign key, a navigation property, and include required menu item id, count, and price to preserve price.
Implement order header and order details storage by adding corresponding database tables, configuring repository and unit of work for both headers and details, and implementing a generic update method.
Implement order header and order detail repositories in ASP.NET Core Razor Pages, configure the db context with migrations, and set up unit of work to manage header and detail updates.
Retrieve and display all shopping cart items on the summary page by loading the order header and cart data, using unit of work and application user repository.
Build and refine the order summary UI in ASP.NET Core Razor Pages by binding inputs with tag helpers and looping through cart items to display totals.
Add client-side validations with ASP validation and span tags for pickup name, phone, date, and time; create the order header with pending status and process Stripe payments.
Handle the on post to create an order header with pending status, set user id, and compute pickup time, then save to generate the id and add order details.
Refine the Razor Pages workflow by moving the save outside the foreach loop to batch update order details, reducing database calls with entity framework core, and prepare Stripe payments integration.
Repository Pattern? Yep.
N-Tier Architecture? Covered!
Credit Card Payments? You got it!
Data-Seeding and Deployment to Azure? It's here!
If you're looking to learn Repository Pattern, N-Tier architecture in record time with ASP.NET Core (.NET 6) you're in the right place! You'll find absolutely no filler content here, only direct, accurate, and concise explanations of exactly how to build professional ASP.NET Core applications.
This is an Intermediate to Advance level course on ASP.NET Core (.NET 6) that will take you from basics all the way to advance mode. This course is for anyone who is familiar with ASP.NET Core basics and wants to know how to architect and code real-world applications in ASP.NET Core.
What are the requirements?
Basic knowledge of ASP.NET Core Razor Pages
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 Core (.NET 6) Project
Learn basic security of ASP NET Core (.NET 6)
Build applications using ASP NET Core (.NET 6) using Razor Pages
Repository Pattern
N-Tier Architecture
Stripe Payments and Refunds
Integrate Identity Framework and learn how to add more fields to Users
Integrate Entity Framework along with code first migrations
Authentication and Authorization in ASP.NET Core (.NET 6)
Sessions in ASP.NET Core (.NET 6)
Data Seeding and deployment to Azure
What is the target audience?
Anyone who wants to learn asp.net core (.NET 6)
Anyone who wants to learn latest changes with Microsoft newest framework