Entity FrameWork using a bootstrap modal popup to change data
<!-- This exemple is using EF and JQuery -->
<!-- Index View -->
<a id="edit" onclick="editProduct(@item.id)" >Edit</a>
<div id="modalEdit">
...
</div>
<script>
function editProduct(id) {
$("#modalEdit").modal('show');
//Add some more cofing
$('#modalEdit > div > div > .modal-body')
//What the method load() will do its go to Controller/Edit
//Do the stuff and load the view into the modal-body
.load('@Url.Action("Edit", "Posto")/' + id);
}
</script>
<!-- Edit view code -->
@{
Layout = null;
}
<!-- This code will be loaded inside of model-body -->
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="idPosto" />
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
<div class="form-group">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</form>