From the course: Building Angular and ASP.NET Web API Apps
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Set a user ID when a transaction is created and loaded
From the course: Building Angular and ASP.NET Web API Apps
Set a user ID when a transaction is created and loaded
- [Instructor] Right now, whenever a user creates a transaction, we do not set the user ID. Other than that, we do not filter the transactions by the user ID. What this means is that any user can view any transaction. In this part, we are going to change that. First, when a user creates a transaction, we will set the logged in user ID to the transaction record. And second, when we log the transactions, we want to show only the transactions of the logged-in user. In Visual Studio, we need to first modify the database so it also supports the user ID. Right now if we open tables and then go to transactions, you'll see that in here we don't have a user ID. Now to add a user ID column in this table, we need to first add a property to the transaction model, then add a migration and push changes to this table. So let us go to the solution explorer, then here, go to models, and then find the Transaction.cs. Then we are going to add another property. We are going to name this property public…
Contents
-
-
-
-
-
-
Understanding token-based authentication3m 2s
-
(Locked)
Configure token-based authentication in ASP.NET Web API5m 49s
-
(Locked)
Build the register API endpoint11m 29s
-
(Locked)
Create the login API endpoint9m 47s
-
(Locked)
Develop the authentication service in angular8m 7s
-
(Locked)
Register for a new account15m 38s
-
(Locked)
Add data validation to a registered form11m 28s
-
(Locked)
Log in to an account6m 6s
-
(Locked)
Secure routes with Angular Guards5m 54s
-
(Locked)
Update the header for logout functionality6m 53s
-
(Locked)
Implement the auth interceptor7m 21s
-
(Locked)
Set a user ID when a transaction is created and loaded8m 28s
-
-
-