
Install Visual Studio 22 Preview Edition and .NET 8 to follow this tutorial, then set up SQL Server Express, SQL Server Management Studio, and Postman.
Set up a free SendGrid account with two-factor authentication and a sender profile. Create and securely save an API key, verify the single sender, and prepare a testing email.
Set up a net 8 web api project and integrate SendGrid by installing packages, configuring appsettings with API key and from email, and creating a send email endpoint.
Create a new dotnet eight web api project in visual studio by selecting the rest api template under c sharp and naming it e-commerce net eight.
Install all necessary NuGet packages for the project, including SendGrid, a pdf library, Automapper, JwtBearer authentication, Identity UI, and EF Core tools, matching the target framework.
Configure authentication and authorization by extending identity with an api user and a custom application db context for a net eight web api on sql server.
Configure JWT authentication for a C# .NET 8 web api eCommerce app by wiring up authentication options, token validation parameters, issuer, audience, and a symmetric security key.
Set up identity settings for the API user by configuring default identity, roles, Entity Framework stores, and token providers, while enforcing password and username rules and enabling authentication before authorization.
Create role constants and a role configuration to seed available user roles into the database using identity roles and on model creating, with roles sourced from a roles.txt file.
Learn to create and apply migrations for a c# dotnet 8 web api ecommerce app, push migrations, update the database, and verify identity tables like roles and api user.
Create register DTOs for the eCommerce web API by designing response and request models with data annotations for email, password, firstname, and lastname.
Create an authorization repository by implementing the IOutRepository with user and admin register endpoints, wiring user manager, configuration, and db context, including secret-key validation.
Create an authorization controller to handle register requests and inject repository and user manager. Implement a post register endpoint that generates an email confirmation code and a verification callback URL.
Create an asynchronous confirm email endpoint in the authorization controller using a dto response, validating user id and code with the user manager, and returning success or error messages.
Build an HTML email link template with inline CSS, store it in a templates folder as an email templates class, reference callback URL in email body, and prepare for SendGrid.
Configure and send emails with SendGrid in a C# .NET 8 web API, injecting the client, reading API key from configuration, and implementing a send email helper for verification.
Register the admin endpoint using a post route with a secret key. Pass the user request and secret to the register admin method and return success or error messages.
Test the register and admin endpoints in a C# .NET 8 web API using swagger, validate email verification, role assignment, and debugging workflows.
Implement a login endpoint in a net 8 web api for an e-commerce app, including login request/response DTOs, user validation, email confirmation, and token plus refresh token.
Test the login endpoint with user@example.com and admin123!, observe a true result and empty tokens, and outline creating functions for token and refresh token.
Generate a jwt in a dotnet web api by building role and user claims from the user, using app settings for issuer, audience, duration, and key.
Fix login validation by adding a password check with userManager.checkPasswordAsync. When the password is invalid, return false and an error 'wrong login credentials'.
Log in with the provided credentials to obtain a jwt token, paste it to inspect payload fields like sub, email, and expiration, then proceed to refresh token testing.
Model and manage refresh tokens, integrate into the database context, generate and store a new token on login, enforce one token per user, and apply migrations.
Test the refresh token functionality by logging in, then executing the app to obtain a refresh token and a token, validating the refresh flow.
Design and implement a verify and generate tokens flow to renew tokens, including a request token DTO, issuer and audience checks, user validation, and new token creation.
Implement a logout endpoint in the C# .NET 8 ecommerce web api to delete the user's refresh token via the repository, using authorization and JWT claims to identify the user.
Use Postman to test login, generate tokens, and logout for the ecommerce API, using Swagger UI for guidance and a bearer token workflow.
Implement and test a resend email verification method in the authorization controller, validating user existence, generating a new token, building a callback URL, and sending the verification email.
Test the send email functionality in a net 8 web api by resending email verification for a new user and confirming an account already verified.
Implement password reset functionality by exposing a get endpoint to send a reset link, validate user, confirm email, generate and encode a token, and send the email.
Design and implement a reset password feature with a post endpoint, request and response models, token decoding, and password validation that returns success or error details.
Reset passwords by sending a password reset email with a token, use the link to set a new password via endpoints, and login to receive a token and refresh token.
Show how to edit user details in the API by creating a request for first and last name, securing a post method with token, and validating with Postman.
Define base product models, including main category, material, and product variants, with navigation properties and json ignore, enabling search by main category.
Define a product variant model linked to base product, color, and size with navigational properties and Json ignore to prevent cycles, then add color and size models and migrate database.
Create a material repository for a C# .NET 8 web API eCommerce app by defining product material DTOs, a material repository interface, and CRUD operations with an application DB context.
Map product material dto to material using Automapper, then add, update, and delete materials in the repository with async save changes.
Build a product material api controller, inject a material repository, expose endpoints to get all materials and by id, and plan a validation repository to prevent duplicate names.
Create a validations repository in the ecommerce web API, implementing IValidationRepository with a db context to check if a material name already exists in the materials table, returning a boolean.
Implement a product material controller with validation checks for duplicates, and expose add, update, and delete material endpoints using validations and material repositories.
Test the product material controller with swagger without authorization, performing get all materials, get by id, add, update, and delete operations, and validate duplicate material prevention.
Develop the main category repository for the e-commerce api, introducing request and response DTOs, and implement get all, get by id, add, update, and delete endpoints via a db context.
Configure a mapper to map requests to the main category model and enable reverse mapping, then implement add, update, and delete operations in the repository with save changes.
Define a main category controller in a C# .NET 8 web API, wiring repositories and validation to provide get all, get by id, add, update, and delete endpoints.
Test the main category controller in a .NET 8 web API ecommerce app by creating, retrieving, updating, validating duplicates, and deleting a main category.
Design and implement a product color repository in a C# .NET 8 web api, creating dtos, a repository interface, and controller actions for CRUD operations.
Create a proto color controller for the web api, wiring a protocol repository and a validation repository to manage get all, get by id, add, update, and delete product colors.
Test the product color controller by adding red, validating duplicates, retrieving all colors and by id, updating to red, and deleting to confirm the controller works.
Build a product size CRUD module for a .NET 8 web API by creating dtos and a repository, wiring dependency injection, and enabling create, read, update, and delete operations.
Implement and map product size crud operations in the repository, including get all, get by id, add, update, and delete with async database access and mapper setup.
Learn to build a product size controller in a C# .NET 8 Web API, implementing get all and get by id, add with validation, update, and delete endpoints.
Test the product size controller by adding, updating, retrieving, and deleting sizes (e.g., XXL), validating duplicates, and confirming removals in a C# .NET 8 eCommerce API.
Create base products with optional product variants and image bases, using custom models and DTOs for requests and responses to structure product base, variant, color, size, and image data.
Implement a base product response with paging for the e-commerce API, including is success, message, total pages, and a base product model with id, name, and price, discount, total price.
This lecture adds a base product response with full info to a C# .NET 8 Web API eCommerce project, including isSuccess and message, and discusses mapping the product with a mapper.
Create and modify base product requests in a c# net 8 web api eCommerce example, defining base product, price, discount, main category, and material DTOs.
Outlines a product repository interface for ai based products in ecommerce api, including paging, get by id with info, updates, removal, and search by material, main category, color, and size.
Build the base product repository with a db context, implement get all async with includes for category, variants, colors, sizes, and images, and provide a converter to detailed model custom.
Implement a base product repository with paging in a C# .NET 8 Web API, including get all with full info by pages and get by id with DTO conversion.
Implement a static convert-to-base-product, transforming a dto to a base product with discount and total price, then add it asynchronously to the database and return the added product.
Update the base product by validating its existence and applying updates to name, description, category, material, price, and discount. Calculate and round total price, save changes, return updated product.
Continue implementing base update functions in a csharp dot net api ecommerce app, covering product price updates, discount handling, total price calculation, database save, and main category and material changes.
Finish base product crud operations by removing the base product method, checking existence with the database, removing the item, saving changes, and returning the removed product in a clear response.
Implement a base product controller with endpoints get all, get all with full info, get all paged, and get by id (no info and full info) via base product repository.
Continues building the base product controller for a C# .net 8 web api ecommerce app, implementing adding, updating (price, discount, main category, material), and deleting base products via repository.
Apply a quick fix in the product repository by correcting the pages repository function from page number to page size to ensure accurate total pages during testing.
Test the base product workflow by creating main category and material, adding, updating, and deleting products, and validating get all, pagination, and full info with price and discount.
Implement get product search suggestions by querying base products with a private search function, filtering by name or description and returning unique, punctuation-stripped words that match the search text.
Create a get product search endpoint that filters base products by name or description containing the search text and includes category, material, product variants with color and size, and images.
Implement get product search with paging in a C# .NET 8 web API, calculating total pages, filtering by search text, including related data, and returning a paged result.
Implement search product functionality by filtering products via material IDs, main category IDs, color IDs, and size IDs, including related data and exposing a search endpoint.
Test filter products in a C# .NET 8 web API eCommerce example by filtering with material IDs and main category IDs. Observe results for matches and null when none.
Implement material and main category validations for base products in the C# .NET 8 web API, checking IDs against the database and returning 400 when not found.
Organize product variant dto details by creating custom models, request and response structures, and initialize properties for base product, color, size, and quantity.
Implement a product variant repository by creating IProductVariantRepository and ProductVariantRepository, wiring them into DI, and defining methods for fetching, adding, updating, deleting, and validating product variants.
Implement the product variant repository by wiring constructors, creating mapper and DTO conversions, and fetching all variants by base product id with related data like product color and product size.
Extend the product variant repository with get variant for validations, add and map new product variants to the database, and convert to a dto without object for a success response.
Implement updating, deleting, and color/size updates for product variants in the repository, performing existence checks, saving changes, and converting to data transfer objects without objects for responses.
Build a net 8 web api product variant controller for ecommerce example, inject repositories, and expose endpoints to fetch all variants by base product ID and a variant by ID.
Implement add and update product variant endpoints, validate duplicates by base product id, color id, and size id, and return the result after creating or updating.
Implement http put endpoints to update product variant by base product id and by color, with validation of base product and color IDs and duplicate prevention.
Update a product variant size by validating the size id, checking variant existence, and applying the update via the product variant repository in a c# .net 8 web api app.
Refactor the add product variant endpoint to validate base product, color, and size with helper checks, returning bad requests for invalid values and failing gracefully.
Test product variant CRUD in a net eight web api e-commerce app by creating base products, colors, and sizes, then update, get, and delete variants to verify behavior.
Implement add and remove quantity in the product variant repository, including existence checks, quantity validation, converting to a DTO, saving changes, and a per-item can-sell check for cart requests.
Continue implementing the product variant repository with get product and sizes functionality. Return all available sizes for a selected color and convert results to data transfer objects for front-end use.
Implement endpoints in the product variant controller to add and remove quantities, verify stock with has enough items, and retrieve product variant sizes by product base and color IDs.
Fix the product variant repository by correcting the minus quantity logic. Test add and remove quantity flows with swagger, validating product variant IDs, quantities, and the can be sold flag.
Implement image upload in an image controller, handle files from form data, save to product-specific folders, expose via static files, and persist image records in the database.
Test image upload in c# .net 8 web api for e-commerce by posting a form file to image/upload with product id, verify image appears and is accessible via its path.
Create a delete image endpoint in a net 8 web api that takes an image id from route, verifies existence, deletes the file, removes the database record, and saves changes.
Test the image delete functionality by removing an image with id two from base products, confirming removal in the ww root folder and resulting in an empty image array.
Create shopping cart models in ecommerce api, defining shopping cart and cart item with id, ip user id, and api user. Update db context with db sets and apply migrations.
Implement a shopping cart repository by defining DTOs, request and response models, and item details (color, size, quantity, total price), and wire it into the app via dependency injection.
Implement a shopping cart repository with methods to get all items, add items, update quantities, remove items, and clear the cart, handling user ids and total price.
Implement the shopping cart add flow: fetch or create a user cart, validate product variant, prevent duplicates, check stock, and return a detailed response after adding or updating cart items.
This lesson implements update quantity for cart items in a net 8 web api, validating quantity, checking stock and cart items, updating quantity, and returning success or error responses.
Develop and refine the shopping cart repository by implementing remove item and clear cart logic, handling null checks, updating quantities, and persisting changes with db save operations.
Implement a shopping cart controller with endpoints to get all items, add items, update item quantity, remove items, and clear the cart, secured for customer roles via the repository.
apply a quick fix to initialize a user cart when none exists by copying the default cart into the user cart for reliable queries.
Test and validate shopping cart operations in a .NET 8 web API by adding, listing, updating, and removing cart items via API endpoints with bearer token authorization and JSON payloads.
Develop order models for a ecommerce web api, including order, order from customer, and items with pdf info; implement return, refund, and exchange workflows and 1-to-1 relationships in db context.
Add and configure db sets for orders, order items, pdf info, address, shipping types, and return items from customers, and define navigation properties in the application db context.
Develop a new address repository for an eCommerce web API using C# .NET 8, including an IAddressRepository interface, AddressRepository implementation, DI setup, and request/response DTOs for CRUD operations on addresses.
Create a net eight address controller with crud endpoints: get all, get by id, get by user id, add, update, and delete, using an address repository and migrations.
Test the address controller in a C# .NET 8 web API e-commerce app by logging in, managing addresses (add, get, update, delete), and previewing shipping types.
Implement a shipping type repository with a dedicated interface and class, add create, read, update, and delete operations using the application db context, and define request and response dtos.
Implement a shipping type controller in a c# .net 8 web api, exposing routes to get all, get by id, add, update, and delete shipping types via a repository.
Test the shipping type controller by creating, updating, retrieving, and deleting shipping types in an eCommerce API, verifying endpoints, IDs, and data changes through a hands-on walkthrough.
Build an order repository in a C# .NET 8 web API for an eCommerce app, including the item at customer model, dto design, migrations, and repository implementation.
Construct the order repository with key dependencies and implement get all orders, get by date, and not sent orders, using includes for original orders, order items, and pdf info.
Implement generate order functionality in a C# .NET 8 web api, mapping user and address data, validating unique identifier, processing shopping cart into order items, applying shipping and discounts.
Implement a generate order workflow in a net 8 web api ecommerce app by fetching the existing order with customer and items, generating a pdf, and persisting updates.
Implement get items at customer to fetch an order by id, include its items and customer; also handle mark order as sent or not sent and save changes.
Implement a .NET 8 API order controller, injecting the order repository and exposing endpoints to list all and not sent orders, and to mark orders as sent or not sent.
Create post endpoint in order controller that takes user id, address id, shipping type id and generates via order repository, returns bad request or ok, tested with swagger and postman.
Fix two bugs in repository: add the product variant size to order items to prevent SQL errors, and downgrade the NuGet package to seven.x to restore PDF documents, then test.
Test end-to-end e-commerce endpoints in a C# .NET 8 web API by adding cart items, authenticating with a bearer token, creating orders with address and shipping, and generating PDFs.
Define and implement exchange item models, including item exchange request, exchange order item, pending and cancelled items, and exchange confirmed PDF info, and wire them into the application db context.
Implement the return exchange request repository, including creating the repository interface and concrete class, defining request and response structures, and wiring dependency injection to support exchange request creation and retrieval.
Implement the exchange request repository and details model in a c# net 8 api, adding response dto, exchange item models, and endpoints for done, pending emails, and pending item handling.
Develop a repository for exchange bad items in a C# .NET 8 ecommerce api app, enabling move pending to bad, get bad items, and add or remove exchange bad items.
Implement an exchange request repository in a .net 8 web api, handling add and move of items between item at customer and return items, with migrations and db context updates.
Implement exchange request repository in a C# .NET 8 web API. Add get all returned items, exchange request creation, models, db context, and a unique exchange identifier generator.
Implement a return exchange request controller and repository in a .NET 8 web api. Expose endpoints to fetch all, by order id, by exchange id, and add requests with authorization.
Add a migration to include exchange requests from users, verify migrations, update the database with dotnet ef database update, and test the endpoints to validate the fix.
Test exchange requests with swagger and postman by adding an exchange request via the API endpoint, validating order identifiers, and confirming retrieval of all exchange requests using a bearer token.
Learn to implement the return exchange repository in a c# .net 8 web api, including create and get exchange requests, and mark exchanges as done with pdf generation.
Implement the async create exchange pdf function in a .NET 8 web API, leveraging the web host environment to generate an exchange pdf with order items and tables.
Continue implementing the return exchange repository by validating existence and status, updating or removing items at customer, handling pdfs, saving changes, and confirming or canceling the exchange request.
This lecture teaches implementing email notifications for exchange returns in a net 8 ecommerce web api: fetch existing exchange orders, configure SendGrid, and send a refund details email.
Create an exchange pending email template in a .net 8 e-commerce web api project, using html tables and dynamic item properties to reflect exchange details and return policy.
Extend the return exchange repository to send an email with a completed PDF attachment, validating existing exchange orders are closed, and configure SendGrid email settings from appsettings.json.
Continue from where we left off, fix the HTML template mistake by using the existing exchange pending template and the existing exchange order, aiming for no errors.
Implement retrieval of exchange good items by converting request items to exchange items, building the list, and handling missing orders to return a success response with exchange items.
Implements ad exchange gold item function in the exchange request repository, validating orders, stock quantities, and returned items, and updating product variants and inventory.
Implement exchange request handling in the repository by locating existing product variants, adjusting quantities, and saving changes, while creating or updating exchange order items for returns.
Implement remove exchange item functionality in the exchange repository: validate item, ensure open exchange, move items to return items from customer, restock variants, and delete the exchange item.
Implement get exchange pending items by converting item exchange requests into exchange pending items, mapping fields, building the pending items list, and handling missing exchanges with dto conversion.
Implement ecommerce exchange request handling by locating existing exchange and order, validating return items from customer, creating or updating exchange item pending, updating quantities, and persisting changes.
Remove a pending exchange item by validating it, locating the related exchange item, updating or creating a returned item, and saving changes when quantity reaches zero.
Move a pending item to good items for exchange by validating existence, stock quantities, and base product, then update quantities and create or update exchange order items.
Validate pending item existence and sufficient quantity, move it to the cancelled items, creating or updating the entry, then save changes and remove remaining pending quantity.
Implement the get all exchange bad items method in the return exchange request repository, adding a static converter to map bad items to DTOs and assemble the response.
Implement the item exchange workflow by validating exchange orders, checking item existence and quantity, updating exchange items and bad items, and saving changes.
Implement remove exchange item functionality in the repository, validating cancelled items, adjusting quantities, managing return items, and ensuring exchange order status before updating the database.
Integrate the exchange request repository into the order controller and implement post endpoints to add and remove return items and fetch all returned items by order id.
Implement exchange endpoints in the order controller, including create and get exchange requests, mark exchange orders as done or not done, and send emails for pending info and complete pdf.
Continue implementing the order controller with endpoints to get, add, and remove exchange items, manage pending items, and move pending items to good or bad states.
Continue building the order controller by exposing endpoints for bad items in exchange, including get all exchange bad items, add exchange bad item, and remove exchange bad item.
Create and push an exchange models migration, then update the database with dot net f migrations add and dot net f database update in the e-commerce net eight project.
Fixes a 500 error by renaming dto fields to exchange item spending detail, updating migrations, and implementing quantity checks to prevent insufficient stock and close exchange requests.
Test exchange workflows in a .NET 8 ecommerce API by logging in with a bearer token, managing carts, creating orders, and processing exchange requests with items, PDFs, and email notifications.
Implement admin-oriented return and exchange functionality by adding a return request model, repository, and database context with a unique exchange identifier generator for the e-commerce net eight web api.
Inject the return request repository into the exchange written request controller and expose endpoints to get all return requests, by order unique identifier, by exchange unique identifier, or by user.
Test four endpoints of the exchange return request controller using swagger to add and retrieve return requests by order and exchange identifiers, with bearer token authorization.
Define three models, item return request, item good for refund, and item bad for refund, configure navigation, json ignore, decimal columns, and register them in the db context with migrations.
Continue building the item return requests feature by creating refund request details folders and defining the request and response classes for refunds, including refund full info and refund items.
Implement a refund repository in a net 8 web api ecommerce project by creating a refund repository interface and class, wiring add scoped in program.cs, and defining core refund operations.
Develop a refund repository in a net 8 web api by creating refunds, checking for existing orders, and updating exchange data, return items, and totals, then saving changes.
Add the item return request navigation property to the order model and implement cancel return item logic in the refund repository, updating orders and totals.
Advance the refund repository by implementing add return item: validate exchange IDs and product variants, manage return item quantities, create or update refund items, and adjust total refunded amounts.
Extend the refund repository to cancel a return item, updating the returned items and totals with price paid per item while saving changes.
Refine the phone repository by implementing refund workflows, handling existing item return requests, checking exchange identifiers, and retrieving good and bad refund items with proper status updates.
Implement the refund repository and template function, sending a refund email via SendGrid configured from appsettings.json (from email, from name) using the html refund template.
Implement refund workflows inside the order controller by injecting a refund repository, exposing endpoints to create, retrieve, update items, cancel refunds, and mark orders as refunded.
Fix a bug in the refund API by adding request refunded and request closed booleans to the refund info response, ensuring correct boolean values and reliable testing.
Test the full return items workflow in a C# .NET 8 web api eCommerce app, covering add to cart, bearer authorization, return and exchange requests, and refunds.
Embark on an immersive exploration into the ever-evolving landscape of modern web development with our C# .NET 8 course. This hands-on tutorial takes students through the intricacies of constructing a robust Web API project, which is based on an eCommerce example. It seamlessly integrates advanced features such as Identity, JWT token authentication, refresh tokens, and functionalities like logout, email confirmation, resend email, and password reset, ensuring an understanding of contemporary development practices.
I will guide you through the implementation of image uploading and deletion mechanisms, providing practical examples. Further enrich your skill set by learning the creation, download, and seamless email transmission of PDF files, showcasing the versatility of your newfound knowledge. Harness the efficiency of SendGrid for email services and hone your expertise in crafting email templates.
This comprehensive course not only equips you with the essential tools and knowledge needed to navigate the complexities of modern web development but also cultivates a profound understanding of .NET. By the end of the course, you'll not only possess a good understanding of .NET but also wield the skills to adeptly create backends for dynamic, feature-rich web applications with a specialized focus on eCommerce functionalities. Elevate your programming prowess, embark on this transformative learning journey, and redefine your capabilities in the dynamic realm of web development