@model Bootstrap_Popup_EF_Insert_MVC.Customer
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width"/>
<title>Index</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">Insert</button>
@using (Html.BeginForm("Index", "Home", FormMethod.Post))
{
<div id="exampleModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Customer Details Form</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label>Name:</label>
@Html.TextBoxFor(m => m.Name, new { @class = "form-control" })
</div>
<div class="form-group">
<label>Country:</label>
@Html.DropDownListFor(m => m.Country, new List<SelectListItem>
{ new SelectListItem{Text="India", Value="India"},
new SelectListItem{Text="China", Value="China"},
new SelectListItem{Text="Australia", Value="Australia"},
new SelectListItem{Text="France", Value="France"},
new SelectListItem{Text="Unites States", Value="Unites States"},
new SelectListItem{Text="Russia", Value="Russia"},
new SelectListItem{Text="Canada", Value="Canada"}},
"Please select", new { @class = "form-control" })
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
}
@if (Model != null)
{
<script type="text/javascript">
$(function () {
alert("Inserted Customer ID: " + @Model.CustomerId);
});
</script>
}
</body>
</html>