- Học kỳ
- SU2026
- Thời Gian
- 7/8/26
- Loại tài liệu
- PE
PRN232 SU26 PE RE NO2
PRN232 Practice Exam Paper No 2
This document outlines the instructions and requirements for a .NET 8 and Entity Framework Core practical examination. It includes database schemas and details four API endpoints to be implemented: retrieving membership packages, filtering members with booking statistics, adding a new package, and removing a package.PRN232 Practice Exam Paper No 2
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 avoid client integration crashes).
- Error handling: If the package PackageName already exists (case-insensitive check), return 400 Bad Request with message "Membership package name already exists".
Đính kèm
-
PRN232 SU26 PE RE NO2_001.webp142.6 KB · Lượt xem: 170 -
PRN232 SU26 PE RE NO2_002.webp127.9 KB · Lượt xem: 159 -
PRN232 SU26 PE RE NO2_003.webp87.8 KB · Lượt xem: 136 -
PRN232 SU26 PE RE NO2_004.webp133.6 KB · Lượt xem: 138 -
PRN232 SU26 PE RE NO2_005.webp91.4 KB · Lượt xem: 120 -
PRN232 SU26 PE RE NO2_006.webp62.7 KB · Lượt xem: 104 -
PRN232 SU26 PE RE NO2_007.webp103.4 KB · Lượt xem: 105 -
PRN232 SU26 PE RE NO2_008.webp147.1 KB · Lượt xem: 118 -
PRN232 SU26 PE RE NO2_009.webp108.2 KB · Lượt xem: 124 -
PRN232 SU26 PE RE NO2_010.webp108.1 KB · Lượt xem: 96 -
PRN232 SU26 PE RE NO2_011.webp157.4 KB · Lượt xem: 75 -
PRN232 SU26 PE RE NO2_012.webp114.4 KB · Lượt xem: 145
Sửa lần cuối:


