
Learn to build a real rest web api using C#, SQL, Dapper, and Json, with a database-first approach and EF Core mappings in ASP.NET Core.
Create a new database in SQL Server Management Studio, switch to it, and define a users table with id as an identity column, plus username, email, password, and email confirmed.
Create and relate tables in sql server management studio, including a co-generation table with a six-digit email verification code and supporting user images, contacts, and addresses.
In this lecture we are going to create the project in Visual Studio.
Demonstrates adding and configuring a connection string in the project for a SQL server database, including local server settings, trusted connections, optional credentials, and enabling multiple active result sets.
The lecture shows how to add an accounts controller to the project, create an empty api controller, and configure a private field and connection string from configuration.
Demonstrate building a SQL Server stored procedure for user registration, including parameter handling, duplicate checks, and inserting into user and cogeneration tables, plus generating a verification code.
Create register user model and register user result model in Visual Studio project, defining username, email, and password, then include user id, username, and email in the result.
Register a user via a secured http post action in Visual Studio, using the RegisterUser stored procedure with dynamic parameters for username, email, and password, returning userId, userName, and userEmail.
hexadecimal is a positional system that represents numbers using a base of 16. it uses sixteen distinct symbols, most often the symbols "0"–"9" to represent values zero to nine, and "A"–"F" (or alternatively "a"–"f") to represent values ten to fifteen.
Don't forget to verify some user's email and to save some user's passwords before hashing them to test sign-in action method.
Implement password hashing in a real REST web API using C#, SQL, Dapper, and JSON, tested via Postman by registering users and verifying hashed passwords in SQL Server.
Create a mail model and send a verification email via api services using smtp, with from email, to email, subject, and body containing the verification code.
Learn to verify a user's email in SQL Server by validating the email and the generated verification code, and updating the user table's emails confirmed flag through a stored procedure.
Organize your Postman test workflow by creating a collection, folder structure for accounts and registered user, and saving user requests to streamline rest api testing.
Create sql server stored procedure that takes an email, checks the users table for email, updates the code with a random value, and selects user id, email, and updated date.
Implement a reset password workflow in a rest web api using C#, sql, and Dapper by creating a reset password procedure, validating email and code, and updating the user password.
Create an upload image class with a static method that uploads a profile image to the application storage. Then save the image path to the database via a file stream.
Add and update a user's address in SQL Server with an upsert stored procedure handling user id, apartment, building, street, city, postcode, country, and test with Postman.
Course Tools
SQL Server Management Studio.
Visual Studio.
Postman.
Advantages of this course :
- Learning in real app, where we design an API that meets business objectives.
Such way is considered to be a highly important learning process. Besides, it equips you with a knowledge that can be easily extended and integrated.
- Building Database first, this approach give the developer a lot of advantages like protect you from losing data, and easier to write SQL commands.
- Using C#, which is an object-oriented, component-oriented programming language that supported by Microsoft, and the best news that it will be immediately familiar to C, C++, Java, and JavaScript programmers.
And the most famous advantage of knowing C# is the expanded wideness to make mobile applications, web applications, games and more.
- Using Asp.Net Core, a free and open-source web framework developed by Microsoft. This framework allows us to include packages in our application which make it faster.
- Using Dapper, that is a tool which maps your database directly with C# objects. Fast in performance with fewer line of code.
- Using Json syntax, which is fast and readable way to exchange data between the server and our application, it’s actually a text that written with JavaScript object notation..