Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task Management Application Objective Develop a basic ASP.NET MVC application to manage a list of tasks. The application should allow users to add tasks and

Task Management Application
Objective
Develop a basic ASP.NET MVC application to manage a list of tasks. The application should allow users to add tasks and view a list of added tasks.
Requirements
Model
Create a Task model with at least three properties: Id (int), Title (string), and IsCompleted (bool).
Views
AddTask: A view containing a form to add a new task. The form should include fields for the task's title and a submit button.
TaskList: A view to display a list of tasks. Each task should display its title and completion status.
Controllers
Create a TasksController with at least two actions:
AddTask (GET and POST): The GET action should display the form to add a new task. The POST action should handle the form submission, add the task to a list (you can use a static list for simplicity), and redirect to the TaskList action.
TaskList: An action that passes the list of tasks to the TaskList view.
Instructions:
Set Up the Project
Create a new ASP.NET MVC project in Visual Studio.
Ensure MVC and Razor support is enabled.
Implement the Model
In the Models folder, add a new class file for the Task model and define the properties as specified.
Implement the Controllers
In the Controllers folder, add a new controller named TasksController.
Implement the AddTask actions (GET for displaying the form and POST for handling form submission).
Implement the TaskList action to pass the list of tasks to its view.
Implement the Views
Create a view for AddTask within the Views/Tasks folder. The view should contain a form for adding a new task. Use the Html.BeginForm() helper for the form.
Create a view for TaskList that iterates over the list of tasks and displays their properties.
Form Submission
In the AddTask view, ensure the form includes @Html.TextBoxFor for the task title and a submit button. Use @Html.CheckBoxFor for the IsCompleted status if you want to include it in the form.
Testing
Run the application and navigate to /Tasks/AddTask to display the form.
Add a new task and submit the form. You should be redirected to the TaskList view, where the new task is displayed.
Evaluation Criteria
Correct implementation of MVC components (Model, View, Controller).
Proper use of form helpers in the AddTask view.
Successful form submission and redirection.
Correct display of tasks in the TaskList view.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Show the properties and structure of allotropes of carbon.

Answered: 1 week ago