1 00:00:01,900 --> 00:00:08,500 On the previous parts, you have set up the models, the…
- User
1 00:00:01,900 --> 00:00:08,500 On the previous parts, you have set up the models, the Abdal Contex file and also the entity framework
2 00:00:08,500 --> 00:00:13,540 core, which are really important for an MVC application to work with data.
3 00:00:14,170 --> 00:00:18,460 Now it's time to add the controllers to your Web application.
4 00:00:18,880 --> 00:00:25,390 And for definition, a controller is just a C sharp claws that is responsible for controlling the way
5 00:00:25,390 --> 00:00:28,480 that a user interacts with an embassy application.
6 00:00:29,080 --> 00:00:33,430 So we basically use controllers to handle the user requests.
7 00:00:33,940 --> 00:00:39,400 So when the user, for example, clicks on a button, there is a controller on the backend which will
8 00:00:39,400 --> 00:00:43,480 receive the request and also return a response.
9 00:00:44,170 --> 00:00:51,430 It is typical for Ambika applications or Web API applications to have controllers for each feature.
10 00:00:51,880 --> 00:00:58,820 Then inside the controllers, you would have methods or as we call them, in the MVC actions, which
11 00:00:58,820 --> 00:01:02,920 will be used for different functionalities within a feature.
12 00:01:03,580 --> 00:01:06,640 So in our case, we are going to have multiple feature.
13 00:01:06,910 --> 00:01:13,810 And for each feature, we are going to create controllers in the management side, which are the features
14 00:01:13,810 --> 00:01:15,400 that an admin user can see.
15 00:01:15,850 --> 00:01:21,790 The user will be able to work with movies, so the user will be able to create a movie, to delete a
16 00:01:21,790 --> 00:01:24,940 movie, to update the movie, or just display all movies.
17 00:01:25,330 --> 00:01:28,090 For that, we're going to have the movies controller.
18 00:01:28,630 --> 00:01:30,730 The same is true for the actors.
19 00:01:30,850 --> 00:01:32,920 So we're going to have an actors controller.
20 00:01:33,460 --> 00:01:39,130 We're going to have a producer's controller and also a cinema controller within our app.
21 00:01:39,130 --> 00:01:44,800 We are going to also have an account controller where the user can update the account details.
22 00:01:45,770 --> 00:01:49,910 Within the same app, we are going to also have the shopping related feature.
23 00:01:50,210 --> 00:01:55,130 So user is able to add items to a cart and the card will be updated in real time.
24 00:01:55,610 --> 00:02:00,280 The user will be able to pay using a PayPal account, etc..
25 00:02:00,590 --> 00:02:02,990 For that, we're going to create two controllers.
26 00:02:02,990 --> 00:02:08,840 The first one is going to be the shopping controller and the orders controller for the order history.
- Assistant
Trong phần trước, bạn đã thiết lập mô hình, tệp Abdal Contex và cơ sở dữ liệu Entity Framework, những điều rất quan trọng để ứng dụng MVC hoạt động với dữ liệu.