Description
Add the model classes Discussion and Comment in the Models folder.
When coding the models below, add the Navigation Properties on both sides of the relationship.
Discussion
int DiscussionId
string Title
string Content
string ImageFilename
datetime CreateDate
Comment
int CommentId
string Content
datatime CreateDate
int DiscussionId (foreign key).
Description
Scaffold the controller/views for the Discussion model.
Description
Scaffold the Comment model. The controller will only include the following action methods:
GET Create
POST Create
Remove all other action methods and views.
The GET method will display the form to add a comment. The comment text field will be a multi-line .
The POST method will create the new comment and re-direct the user to the āGet Discussionā page if successful (you will create this page in another task).
Description
When creating a discussion thread, the user can upload an image. The image should be saved in the /wwwroot/images folder and the file should be renamed to a unique filename (e.g., a guid or datetime).
The database record should store the image filename so it can be fetched and displayed.
Description
On any page where a discussion thread is shown in a list, display a thumbnail of the image.
On a page that shows a particular discussion, show a larger display of the image.
Basically, treat the image as part of the record and show the detail accordingly.
Description
On the home page (HomeController Index method), display all the discussion threads in descending order by create date. For each discussion, display:
image thumbnail
title
number of comments
create date / time
In the HomeController, add a new action method āGetDiscussionā and create a corresponding View.
When the user clicks the title on the Home Page, re-direct the user to the āGetDiscussionā page.
Description
On the āGet Discussionā page, display the discussion info and the comments in descending order by create date.
Above the list of comments, display a link to add a new comment. When the user clicks the link, re-direct to the Create Comment page.</p></div><div></div>