I'm building a MVC Web Application. I'm stuck at how to POST data when a user checks off the rows they want removed, then update the existing data to show if it was successful or not.
Model:
public class RemoveFromCollectionVM
{
public int ResourceID { get; set; }
public string ComputerName { get; set; }
public IEnumerable<axp.euc.sdsassistance.core.Models.sccmCollections> collections { get; set; }
}
The sccmCollections Model:
public class sccmCollections
{
public string CollectionName { get; set; }
public string CollectionID { get; set; }
public string Status { get; set; }
public bool RemoveFromCollection { get; set; }
}
I can populate the data when the PC is entered. Displays the data in a PartialView:
@using (Html.BeginForm("SUBMIT", "SCCM", FormMethod.Post))
{
<table class="table table-responsive list-view">
<thead>
<tr>
<th>Software</th>
<th>CollectionID</th>
<th>Select</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.collections)
{
<tr>
<td>@item.CollectionName</td>
<td>@item.CollectionID</td>
<td>@item.Status</td>
<td><input type="checkbox" name="selectedObjects" value="@item.CollectionID"/></td>
</tr>
}
</tbody>
</table>
<input type="submit" title="SUBMIT"/>
}
The problem I'm having is the POST. When I click on Submit the RemoveFromCollectionVM Model is null. I need to pass the PC Name, ResourceID and the Collection ID in order to remove. I was figuring to update the Model then return a new PartialView which would reload the list, but provide the Status Update.
Any Thoughts or Direction would be greatly appreciated!
Aucun commentaire:
Enregistrer un commentaire