Let's familiarize ourselves with the process by using the Directory management on the administrator interface.
1. we want to view all directories in the same way as category/list. category/New is used to add directories and category/edit/{ID} is used to modify directories, category/delete/{ID} to delete a directory.
URL format |
Action |
URL example |
/Category/List |
Browse all directories |
/Category/List |
/Category/edit/ID |
Edit Selected directory |
/Category/edit/1 |
/Category/delete/ID |
Delete restricted directories |
/Category/delete/2 |
/Category/Add |
Add directory |
/Category/Add |
2. If you want to access the corresponding function based on the above address, first we need a category controller. In the Controller directory, create a new categorycontroller.
3. Define the following behavior in categorycontroller (Note: All public methods are a controller action, which is a change in preview2)