I want to allow the user to check a box next to each item that they consider as "Good" and also allow them to delete the list of items with 2 separate button presses. How do I pass data to the corresponding controller actions?
I have an IEnumerable list of objects that contain a bool field.
Public class fruit
{
public string Name { get; set;}
public bool IsGood {get; set:}
}
I am displaying this in a table like so:
@model IEnumerable<Fruit>
<table>
<thead>
<tr>
<th>Good?</th>
<th>Name</th>
</tr>
</thead>
@foreach (var item in Model)
{
<tbody>
<tr>
<td><input type="checkbox" class="checkbox" value="@item.IsGood" /></td>
<td>Item.Name</td>
</tr>
<tbody>
</table>
}
<input class="btn btn-primary" type="submit" name="Update" id="Update" value="Update" />
<input class="btn btn-danger" type="submit" name="Delete" id="Delete" value="Delete" />
How can this be done?