First of all, my code is as follows:
Index.cshtml:
@using ToDoListApp.Models
@model List<TodoTable>
<br />
<div class="p-3 mb-2 bg-dark text-white">All Tasks</div>
<table class="table table-hover">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Task</th>
<th scope="col">Urgent</th>
<th scope="col">Done</th>
<th scope="col">Transactions</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<th scope="row">@item.Id</th>
<td>@item.Name</td>
<td>@(item.Urgent ? "Yes" : "No")</td>
<td>@(item.Done ? "Yes" : "No")</td>
<td>
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
Transactions
</button>
<ul class="dropdown-menu" aria-labelledby="TransactionsMenu">
<li><a class="dropdown-item" href="/Urgent/@item.Id">@(item.Urgent ? "Unurgent" : "Urgent")</a></li>
<li><a class="dropdown-item" href="#">@(item.Done ? "Undone" : "Done")</a></li>
</ul>
</div>
</td>
</tr>
}
</tbody>
</table>
Controller:
[HttpGet]
public ActionResult Urgent(int id)
{
var Task = db.TodoTables.SingleOrDefault(i => i.Id == id);
return View("Index", id);
}
[HttpPost]
public ActionResult Urgent(TodoTable t)
{
var Task = db.TodoTables.SingleOrDefault(i => i.Id == t.Id);
Task.Urgent = !t.Urgent;
db.SaveChanges();
return RedirectToAction("Index");
}
If the image is:
After pressing the Urgent button in the Drop down menu, if it will do the opposite of the Urgent value in the database. So for example if the value is True it will set False. If it is False, it will set True.
I put my codes above. If the problem is, when I access the page, I get the error "This page could not be found".
Why could this be? How can I solve the problem?

