I have a list of models that are displayed on the views. Say they are a list of Task. The list has a check button where one can check if Task is done. I want them to be updated on the database at once. How would I do that ?
Here's how my controller looks like :
public async Task<ActionResult> TaskManager(Tasks model, string id)
{
var user = await UserManager.FindByIdAsync(id);
var list = from task in context.Tasks.Where(t=> t.isAssigned == false)
select task;
foreach(var t in task)
{
t.isAssigned =(bool) // FROM EACH LIST ITEM IN THE VIEW ;
}
await context.SaveChangesAsync();
return View();
}