讲解program语言、辅导Python,C/C+程序、Java编程设计调试

- 首页 >> Python编程
Introduction
You will continue working with the music business problem domain introduced in assignment #5. In this assignment, the
web app will be enhanced to support security concepts as well as richer data such as rich text and media files (images,
audio files, and videos).
Specifications overview and work plan
Here is a brief work plan sequence:
1. Create the project using the “Web App Project Template W2021 V3”
2. Customize the app’s appearance.
3. Create the design model classes.
4. Create view models and mappers that cover the use cases.
5. Configure the security settings for the app.
6. Add methods to the Manager class that:
a. load initial data
b. handle the use cases
7. Implement rich text editing and media item handling.
8. Publish your web app to Azure.
Page 2 of 20
Getting started
Create a new web app named “Assignment6”. You must use the “Web App Project Template W2021 V3” project
template provided by your professor. The project template is available on the course website (on Blackboard).
You may update NuGet packages and build the app to ensure an error-free base but DON’T run the app yet.
As you write code, you should build frequently. If your project has a compilation error and you are unsure how to fix it,
contact your professor and include the error message details – there may be a simple fix. Some problems may be
challenging for your professor to solve over email, so use your in-class time to work on assignments.
The best way to work through this assignment is to work on each task incrementally. Get one task working before
moving on to the next task. Test each task as you complete them.
Temporarily disable error-handling for HTTP errors 500 and higher
Open the Global.asax.cs source code file. In the Application_EndRequest() method, temporarily comment out the
following statement:
if (code >= 500)…
Verify the Upload.cshtml partial view
Go to the Shared folder. If the folder and/or file EditorTemplates/Upload.cshtml does not exist, please add them.
Customize the app’s appearance
You will customize the appearance of your web apps and assignments. Never submit an assignment that has the
generic auto-generated text content. Please make the time to customize the web app’s appearance.
For this assignment, you can defer this customization work until later. Come back to it at any time and complete it before
you submit your work.
Follow the guidance from Assignment 1 to customize the app’s appearance, including the links/text in the page header
and footer. For this assignment, you may remove the About and Contact pages but do not forget to remove the links
from the navigation bar as well.
After creating the web app, customize the home page. Change the large “Learn more >>” button to “Assignment 6 on
Azure” and set the button link to the URL of your assignment on Azure.
WEB524 – ASSIGNMENT #6 – WINTER 2021 DUE: APRIL 21, 2021 @ 11:59 PM
Page 3 of 20
Load data and test your app
After creating your project, you will need to login so that you can seed the initial data. Create the first user account:
admin@example.com. After it is created, login with this account.
Use the LoadData controller and call the manager object’s LoadData() method to load initial data for the web app.
Test your work by attempting to register a new user. The new role claim list should appear on the “register” page and
enable the correct configuration of a new user.
WEB524 – ASSIGNMENT #6 – WINTER 2021 DUE: APRIL 21, 2021 @ 11:59 PM
Page 4 of 20
Data storage preparation tasks
Next, enable Migrations. Migrations will create a starting point (snapshot) of the database structure. You may need to
review previous assignments if you need help remembering the commands.
Prepare for security-aware content
You will continue to use the user account security ideas that were implemented in the previous assignment. In other
words:
• A user with an Executive role claim can add, edit, and delete an artist.
• A user with a Coordinator role claim can add, edit, and delete an album.
• A user with a Clerk role claim can add, edit, and delete a track.
• All other kinds of authenticated users can read artist, album, and track data.
• Anonymous users cannot work with artist, album, and track data.
Add these kinds of users to your app, using the revised Register page.
Recently, you learned how to conditionally enable functionality based on information in the security principal (e.g.
authenticated or not, user info, role claim info). Menu item and content containers could be visible, or not, depending
upon the user.
In this assignment, you must implement these ideas. In general:
• Menu items – “Artists”, “Albums” and “Tracks” – should appear to authenticated users only.
• Content containers – links/buttons connecting to all “Add new” pages – should appear (or not), based on the
user.
As you make progress coding a feature, pause for a moment and decide whether security should influence who/when
users can see the feature on the user interface.
Preparing for rich text editing
The Artist and Album design model classes need another string property, to hold rich text.
In the Artist class, add a new string property named “Biography”. It is not required and will be lengthy. Its intention is
to capture content about the history, biographical data, and musical style of the artist.
In the Album class, add a new string property named “Summary”. It is not required and will be lengthy. Its intention is
to capture content about the theme, style, content, and assembly of the album.
Important: Make sure you name these ‘lengthy’ properties exactly as specified.
WEB524 – ASSIGNMENT #6 – WINTER 2021 DUE: APRIL 21, 2021 @ 11:59 PM
Page 5 of 20
Build the app and run it in a browser. Uh oh, an error:
As the error states, the data model has changed. To fix this, review the coverage of the Migrations feature in the lecture
notes:
1. add-migration descriptive-name-for-migration.
2. update-database
Later, remember this “recipe” for enabling rich text editing and display:
1. Add [DataType(DataType.MultiLineText)] to the string property in the view model class.
2. In the view, before the code that renders the string property, add a reference to the rich text editor app.
3. After the code that renders the string property, run the command to convert the