cmp376 Thuc Hanh Lap Trinh Web
cmp376 Thuc Hanh Lap Trinh Web
Lập trình web (Trường Đại học Bách khoa - Đại học Quốc gia Thành phố Hồ Chí Minh)
T
Biên
www.hutech.edu.vn
*1.2021.CMP376*
Các ý - :
[email protected]
I
M L
...................................................................................................................I
........................................................................................................... II
................................................. 1
T WEB APPLICATION MVC 5 .. 1
.......................................................................................................... 1
..................................................................................... 1
TÓ .................................................................................................................. 7
...................................................................................................... 7
........................................ 8
.............................................................................................. 8
.............................................................................. 17
................................................................................................................ 19
.................................................................................................... 19
-SCHOOL ........................................... 20
...................................................................................... 20
................................................................................................ 21
....................................................................................................... 21
........................................... 21
.................................................................... 21
3.4.2 Phân tích use case ......................................................................................... 22
- .......................................................................... 23
...................................................... 23
.................................................... 23
3.5.2 Use- ........................................................................ 28
................................................................. 44
............................................. 46
3. ................................ 47
(Form Sign up) .................... 49
.......................... 51
3.5.8 Use- .............................................................. 53
3.5.9 Use- .......................................................................... 60
3.5.10 Xem danh sách k ..................................................... 65
3.5.11 Use- .................................................... 69
3.5.12 Use-case thông báo (notification) .................................................................. 80
................................................................ 85
................................................................................................................ 88
.................................................................................................... 89
............................................................................................ 90
II
cao.
- Bài 1:
- Bài 2:
- Bài 3: -School
sinh viên
sinh viên
sinh viên
thúc toàn b sinh viên .
III
- (100%):
BÀI 1: 1
BÀI 1:
WEB ASP.NET MVC
nh
- Windows 7
- Windows 8
- Windows 10
1.1.2 t MVC5
website http://www.microsoft.com/en-
us/download/41532
Chú ý: Visual
Studio 2013 & Visual Studio 2015
- ng ASP.NET MVC 5
2 BÀI 1:
New Project
Visual C# Web
Template
BÀI 1: 3
Web Application MVC5 MVC
MVC Application
4 BÀI 1:
c Mô t
/Controllers c ch a các l p x lý g i là Controller
/Models c ch a các l ng Model
/Views t các m u giao di n View
/Scripts c ch a các b n javascript c tích h p
vào s n c a MVC ho n t ch
vi n Javascript mà mình t phát tri n
/fonts Ch a các m u font c n Bootstrap
/Contents t CSS, hình nh ho c các file javascript
/App_Data Ch a database local
/App_Start Các l p c u hình c a ng d Routing, Bundling
(h tr nén CSS, javascript gi c)
BÀI 1: 5
Views/Home/Index.cshtm,
RouteConfig
http://Localhost:Port:/{Controller}/{Action}/{Id}
6 BÀI 1:
BÀI 1: 7
TÓM
-end,
-
C
Câu 1: Mô hình MVC là gì? Các thành MVC ?
8 BÀI 2:
BÀI 2: V
BÀI 2: 9
10 BÀI 2:
BooksController.cs
BÀI 2: 11
ListBooks
File Views/Books/ListBooks.cshtml
12 BÀI 2:
File App_Start/RouteConfig.cs
website
BÀI 2: 13
(Book Detail)
Views/Books/ListBook.cshtml
14 BÀI 2:
Xem Link
BÀI 2: 15
Trang Views/Books/Detail.cshtml
File Views/Books/ListBooks.cshtml
16 BÀI 2:
File BooksController.cs
Views/Books/Edit.cshtml
BÀI 2: 17
2.2 RÀNG BU C D LI U NH P
File Models/Book.cs
File Views/Books/Edit.cshtml
18 BÀI 2:
File Controllers/BooksController.cs
BÀI 2: 19
TÓM
20 BÀI 3: - SCHOOL
- Restful APIs
- Entity Framework 6
- ASP.NET Identity
- Bootstrap
- Bootbox js
- Jquery
BÀI 3: - SCHOOL 21
3.2 MÔ T YÊU C U
3.3 PH N M M
- án giúp
22 BÀI 3: - SCHOOL
3.4.2.2 Khóa h c
- Thê
3.4.2.3 c
BÀI 3: - SCHOOL 23
-
- theo dõi
3.4.3 Th t use-case s th c hi n
1 2 3 4 5
Xem danh sách
ra
Danh sách
viên
Big school Feed
enable-migrations
24 BÀI 3: TH - SCHOOL
- Models/IdentityModel.cs
- ,
- Web.config
<connectionStrings>
</connectionStrings>
BÀI 3: - SCHOOL 25
Add-
- Add
Course.cs
26 BÀI 3: - SCHOOL
- Course.cs
BÀI 3: - SCHOOL 27
- Models/IdentityModel.cs
- File Models/IdentityModes.cs
Models/ApplicationUser.cs
)
- Models có
add-migration 'CreateTableCourse'
update-database
28 BÀI 3: - SCHOOL
add-migration PopulateCategoryTable
update-database
BÀI 3: - SCHOOL 29
- Category
- Controller
Empty Controller
- CoursesController Controller
30 BÀI 3: - SCHOOL
- Add
View
- T ra
Create.cshtml
BÀI 3: - SCHOOL 31
- Views/Courses/Create.cshtml F5
- :
32 BÀI 3: TH - SCHOOL
-
http://getbootstrap.com/
- DateTime
(n
BÀI 3: - SCHOOL 33
- folder tên là ViewModels
- ViewModels/ :
- Views/Course/Create.cshtml
34 BÀI 3: - SCHOOL
- c: Views/Course/Create.cshtml
BÀI 3: - SCHOOL 35
-
36 BÀI 3: - SCHOOL
Form (views/Course/Create.cshtml)
i ASP.NET Identity.
.
- File Controllers/CourseController.cs
BÀI 3: - SCHOOL 37
- File Views/Course/Create.cshtml
- File Controllers/CoursesController.cs
38 BÀI 3: - SCHOOL
- http://localhost:50528/Courses/Create )
Server-side Validation
- File ViewModels/CourseViewMode.cs
BÀI 3: - SCHOOL 39
- File Views/Course/Create.cshtml
- File Controllers/CoursesController.cs
tác)
40 BÀI 3: TH - SCHOOL
Custom validatation
-
(dd/MM/yyyy)
- ViewModels/FutureDate.cs ViewModels
BÀI 3: - SCHOOL 41
- File ViewModels/CustomViewModel.cs
42 BÀI 3: - SCHOOL
-
ValidTime.cs ViewModels
CourseViewModel.cs (ViewModels/CourseViewModel.cs)
- Time
Client-
BÀI 3: - SCHOOL 43
-
44 BÀI 3: - SCHOOL
3.5.3 nh c a Bootstrap
- Chorme
Inspect
- file Contents/Site.css
BÀI 3: - SCHOOL 45
- File Contents/Site.css
- File Views/Shared/__LoginPartial.cshtml
46 BÀI 3: - SCHOOL
- File Models/ApplicationUser.cs
BÀI 3: - SCHOOL 47
-
add-migration AddNameColumnToApplicationUser
update-database
- Name (ex:
- File Controllers/HomeController.cs
48 BÀI 3: TH - SCHOOL
- File Views/Home/Index.cshtml
- http://localhost:50528/ )
BÀI 3: - SCHOOL 49
3.5.6 B sung thu c tính Name vào mà
i dùng nh p tên (Form Sign up)
- File Models/AccountViewModels.cs, Class RegisterViewModel
50 BÀI 3: - SCHOOL
- File Views/Account/Register.cshtml
- File Controllers/AccountController.cs
BÀI 3: - SCHOOL 51
-
(http://localhost:50528/Account/Register)
52 BÀI 3: - SCHOOL
- File Content/Site.css
BÀI 3: - SCHOOL 53
3.5.8 Use- khóa h c
User và Course Attendance
User Course
Attendance
- Models/ApplicationDbContext.cs
54 BÀI 3: - SCHOOL
Update database
- File Controllers/AttendancesController.cs
API 2 Controller
BÀI 3: - SCHOOL 55
- - AttendancesController
- Global.asax,
- File Controllers/AttendancesController.cs
56 BÀI 3: TH - SCHOOL
- https://www.getpostman.com/)
- -
BÀI 3: - SCHOOL 57
-
- SEND khi t
vào CSDL
58 BÀI 3: - SCHOOL
- File Controllers/AttendancesController.cs
- Build Postman
BÀI 3: - SCHOOL 59
- File Views/Home/Index.cshtml
- DTOs
DTOs/AttendanceDto.cs (DTO: Data transfer object,
60 BÀI 3: - SCHOOL
- File Controllers/AttendancesController.cs
- Models/Following.cs
BÀI 3: - SCHOOL 61
- File Models/ApplicationUser.cs
- File Models/ApplicationDbContext.cs
62 BÀI 3: - SCHOOL
Add-migration AddFollowingsTable
Update-database
- File DTOs/FollowingDto.cs
- File Controllers/FollowingsController.cs
BÀI 3: - SCHOOL 63
- File Views/Home/Index.cshtml
64 BÀI 3: TH - SCHOOL
- ViewModels/CoursesViewModel.cs
- File Controllers/HomeController.cs
- File Views/Home/Index.cshtml
BÀI 3: - SCHOOL 65
-
- trang
Views/Home/Index.cshtml
66 BÀI 3: - SCHOOL
- File Views/Shared/_LoginPartial.cshtml
BÀI 3: - SCHOOL 67
Follow, Going
- File Controllers/CoursesController.cs
68 BÀI 3: - SCHOOL
- File Views/Courses/Mine.cshtml
My Upcomming Course.
BÀI 3: - SCHOOL 69
3.5.11 Use-case Qu n lý Khóa h c (Xóa, c p nh t)
- File Views/Courses/Mine.cshtml
70 BÀI 3: - SCHOOL
- File Controllers/CoursesController.cs
- File Views/Courses/Mine.cshtml
BÀI 3: - SCHOOL 71
-
- File ViewModels/CourseViewModel.cs
72 BÀI 3: TH - SCHOOL
- File Controllers/CoursesController.cs
BÀI 3: - SCHOOL 73
- File Views/Courses/Create.cshtml
- Views/Courses/CoursesForm.cshtml
74 BÀI 3: - SCHOOL
- File Models/Course.cs
Add-migration AddIsCanceledColumnToCourse
Update-database
BÀI 3: - SCHOOL 75
http://bootboxjs.com/
js
- File App_Start/BundleConfig.cs
76 BÀI 3: - SCHOOL
- File Views/Courses/Mine.cshtml
BÀI 3: - SCHOOL 77
-
78 BÀI 3: - SCHOOL
BÀI 3: - SCHOOL 79
Di chuy
phím ctrl + shift + r)
80 BÀI 3: TH - SCHOOL
- Models/NotificationType.cs
- Models/Notification.cs
- Models/UserNotification.cs
BÀI 3: - SCHOOL 81
Add-
Update Database
82 BÀI 3: - SCHOOL
- Models/ApplicationDbContext.cs
Add- -force
Update Database
BÀI 3: - SCHOOL 83
- Controllers/Api/CoursesController.cs
84 BÀI 3: - SCHOOL
- File Views/Home/Index.cshtml
BÀI 3: - SCHOOL 85
- File Controllers/AttendancesController.cs
- File Views/Home/Index.cshtml
86 BÀI 3: - SCHOOL
BÀI 3: - SCHOOL 87
- File App_start/BundleConfig.cs
- File Views/Shared/__Layout.cshtml
88 BÀI 3: TH - SCHOOL
TÓM
-first, Entity
PI cho
BÀI 3: - SCHOOL 89
90
TÀI
1. Pro ASP.NET MVC 5 (2013 ), ISBN-10: 1430265299, Apress; 5th ed. edition
2. ASP.NET MVC 5 - Building a Website with Visual Studio 2015 and C Sharp (2016),
ISBN-10: 1535167866, CreateSpace Independent Publishing Platform
3. ASP.NET MVC with Entity Framework and CSS (2016), ASIN: B01LYSLEMA,
Apress; 1st ed. edition