This project is to build a website for the imaginary Three Sisters Hotel that is going to serve the Blue Mountains area, after the Covid-19 pandemic is possibly under control by the end of this year. This website should allow customers to search and book rooms, and allow administrators to manage bookings and view statistics, etc.
You are suggested to read the entire specification first, and then start with the tasks that are already covered by our lectures.
Creating project in Visual Studio (VS)
Since the project needs to support authentication for customers and administrators, it needs the ASP.NET Identity package in the very beginning. To include this package in your project, you should carefully follow the slides in our Lecture 9, which is released on vUWS already.
During the above process, you should name the SQLite database file "ThreeSisters.db". In this project, you are going to use it to store data not only for authentication, but also for the Three Sisters Hotel.
Moreover, you should follow the slides in Lecture 9 to scaffold the source code of the Identity package into your project.
Finally, when you run this project, you should see the Register and Login links appear in the right of the navigation bar.
Two roles of administrators and customers
Besides maintaining users’ credentials, the Identity package can also assign users with different roles. You are required to use this package to divide the users of this website into two roles: administrators and customers. You should create only one user with the 'administrators' role, and set up his/her username to be 'firstname.lastname@example.org' and his/her password to be 'P@ssw0rd' when the web application starts. On the other hand, all users registering into the website by clicking the 'Register' link mentioned in the Section 3 below should be assigned the 'customers' role.
Moreover, source code should be added to the Pages/Shared/_Layout.cshtml file such that, after logging in, administrators and customers only see links that they should have access to in the navigation bar. (see the details in the Section 3 below)
NB: We will discuss the above in our Lecture 09. You can start to implement them after Lecture 9.
Navigation and layout
All pages in your website should share a consistent layout, which has a navigation bar in the top.
This should be achieved by using _Layout.cshtml and Bootstrap.
The links contained in the navigation bar should be dynamic. The detailed requirements are as follows:
Statistics and Logout.
Note: How to make the links dynamic are discussed in Lecture 9. You can start with include all the links in the navigation bar, and make them dynamic after Lecture 9.
The Home link in the navigation bar leads to this page, which should display:
This website should use the following three Model classes. Each class has certain properties. The requirements on these properties are also described below. You should apply appropriate data types and data annotations to fulfil these requirements.
You should fully create these Model classes first, and then scaffold them one by one, and then migrate them to database together. You are suggested to do these by following our Lecture 8.
NB: During scaffolding, you should choose the ApplicationDbContext used by Identity as the DbContext (i.e., select the database used by Identity). During migration, in case you see the complaint that SQLite does not support certain operation, you should comment out the migration code in the Up() and Down() methods related to that operation. These two methods can be found in the .cs file under the 'Migrations' folder.
The Room class models the rooms in Three Sisters Hotel. It should have the following properties.
|Level||string||Meaning the level of this room; Exactly one character of ‘G’, ‘1’, ‘2’, or ‘3’. Required.|
|BedCount||int||Meaning the number of beds in the room; can only be 1, 2, or 3.|
|Price||decimal||Meaning the price per night; Between $50 and $300.|
|TheBookings||ICollection<Booking>||This is a navigation property |
After scaffolding and migrating this class into database, you should use the https://localhost:xxx/Rooms web interface to manually populate the Room table with the following data. (NB: For the convenience of marking, you must use the data below.)
The Customer class models all customers who have ever registered with Three Sisters Hotel. It should have the following properties.
|Email||string||Primary key; Required; Valid email address; Since its name|
|doesn't follow the convention to be the primary key, you|
For solution, connect with our online professionals.