- Học kỳ
- SU2026
- Thời Gian
- 8/8/26
- Loại tài liệu
- PE
PRN232 SU26 PE RE NO4
PRN232 SU26 PE RE NO4
This document contains exam instructions, database schema diagrams, and four specific API implementation requirements for a .NET 8 and Entity Framework Core practical exam. It details the endpoints, filtering logic, and expected responses for managing membership packages and member statistics.PRN232 SU26 PE RE NO4
INSTRUCTIONS
Please read the instructions carefully before doing the questions.
- You can use materials in your computer, notebook and text book.
- You are NOT allowed to use any device to share data with others.
Beside the above conditions, students must follow the following requirements:
1. The work must complete by using Visual Studio 2022++
2. The Framework must be .NET 8.0
3. THIS PART IS VERY IMPORTANT, PLEASE READ IT CAREFULLY AND FOLLOW THE INSTRUCTIONS.
- You are given a database script (.sql file) in Zip file. Execute the script before doing questions.
- You must use the given solution.
- You are not allowed to add any more libraries via NuGet Package Manager into given solution.
- Submission Guideline:
Submit your work for each question separately. For each question, please:
- Publish your project using the command:
dotnet publish -c Release -o ./[QuestionNumber_StudentAccount]
Example:
dotnet publish -c Release -o ./Q1_trungnthe123432
- Submit the root folder of the project into the PEA_Client application.
- If the root folder of the project is too large, you may delete the following subfolders to reduce its size before submitting: /bin, /obj
Just one of above requirements is violated, your work will be considered as invalid.
Question 1:
You are provided with a database as following diagram
Ensure that the database connection string is adjustable through appsettings.json (otherwise your post will get 0 point) as pattern:
{
"ConnectionStrings":
{
"MyCnn":""
}
}
Your task is to implement the following APIs using .NET 8 and Entity Framework Core:
Method: GET
URL: /api/MembershipPackages
Description: Retrieve all membership packages with registered member count statistics. Supports JSON.
Method: GET
URL: /api/filter-members
Description: Advanced search for members with training duration stats and recent coach assignment logs.
Method: POST
URL: /api/MembershipPackages
Description: Add a new membership package to the gym catalog.
Method: DELETE
URL: /api/MembershipPackages/{packageId}
Description: Remove a membership package from the system.
1. GET /api/MembershipPackages
- Retrieve a list of all membership packages from the database.
- Response Fields:
PackageId (int)
PackageName (string)
Price (decimal)
MemberCount (int): Total number of gym members currently registered under this membership package.
2. GET /api/filter-members
Retrieve a list of gym members with advanced booking performance statistics.
- Filtering Logic:
packageId (int, optional): If specified, return only members registered with this Package ID.
minDuration (int, optional): If specified, return only members who have booked sessions with a duration greater than or equal to this value.
- Response Fields:
MemberId, FullName, JoinDate, PackageName.
TotalMinutesTrained (int): The total sum of DurationMinutes across all booking sessions associated with this member in the BookingDetails table. Return 0 if there are no sessions.
LastTrainerName (string): The TrainerName of the personal trainer who coached this member most recently (based on Bookings.SessionTime descending). If the member has never booked any sessions, return "No Trainers".
- Error handling: Return 400 Bad Request if minDuration is negative (if provided).
- Sorting: Sort results by JoinDate in descending order (newest members first).
3. POST /api/MembershipPackages
Accept PackageName and Price inside the request body.
- Return: 201 Created along with the complete newly created MembershipPackage entity (ensure navigation properties like Members are returned as empty lists [] instead of null to match).
Đính kèm
-
PRN232 SU26 PE RE NO4_01.webp50.7 KB · Lượt xem: 39 -
PRN232 SU26 PE RE NO4_02.webp48.7 KB · Lượt xem: 36 -
PRN232 SU26 PE RE NO4_03.webp28.1 KB · Lượt xem: 36 -
PRN232 SU26 PE RE NO4_04.webp48.5 KB · Lượt xem: 36 -
PRN232 SU26 PE RE NO4_05.webp29.9 KB · Lượt xem: 30 -
PRN232 SU26 PE RE NO4_06.webp29.6 KB · Lượt xem: 29 -
PRN232 SU26 PE RE NO4_07.webp25.1 KB · Lượt xem: 25 -
PRN232 SU26 PE RE NO4_08.webp31.9 KB · Lượt xem: 23 -
PRN232 SU26 PE RE NO4_09.webp39 KB · Lượt xem: 25 -
PRN232 SU26 PE RE NO4_10.webp42.4 KB · Lượt xem: 20 -
PRN232 SU26 PE RE NO4_11.webp42.5 KB · Lượt xem: 21 -
PRN232 SU26 PE RE NO4_12.webp26.7 KB · Lượt xem: 23 -
PRN232 SU26 PE RE NO4_13.webp35.6 KB · Lượt xem: 18 -
PRN232 SU26 PE RE NO4_14.webp57.9 KB · Lượt xem: 15 -
PRN232 SU26 PE RE NO4_15.webp50.2 KB · Lượt xem: 15 -
PRN232 SU26 PE RE NO4_16.webp43.9 KB · Lượt xem: 30 -
PRN232_SU26_B1_PE_L2_No4_materials.zip2.9 MB · Lượt xem: 3


