Created
October 27, 2019 17:59
-
-
Save nirzaf/1f7f78b2beb0509318df51adbc08f500 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page "/fetchemployee" | |
@inherits EmployeeDataModel | |
<h1>Employee Data</h1> | |
<p>This component demonstrates CRUD operation on Employee data</p> | |
<div> | |
<div style="float:left"> | |
<button class="btn btn-primary" onclick="@AddEmp">Add Employee</button> | |
</div> | |
<div style="float:right; width:40%;"> | |
<div class="col-sm-6" style="float:left"> | |
<input class="form-control" type="text" placeholder="Search" bind="@SearchString" /> | |
</div> | |
<div> | |
<button type="submit" class="btn btn-default btn-info" onclick="@FilterEmp">Filter</button> | |
</div> | |
</div> | |
</div> | |
@if (empList == null) | |
{ | |
<p><em>Loading...</em></p> | |
} | |
else | |
{ | |
<table class='table'> | |
<thead> | |
<tr> | |
<th>ID</th> | |
<th>Name</th> | |
<th>Gender</th> | |
<th>Department</th> | |
<th>City</th> | |
</tr> | |
</thead> | |
<tbody> | |
@foreach (var emp in empList) | |
{ | |
<tr> | |
<td>@emp.EmployeeId</td> | |
<td>@emp.Name</td> | |
<td>@emp.Gender</td> | |
<td>@emp.Department</td> | |
<td>@emp.City</td> | |
<td> | |
<button class="btn btn-default" onclick="@(async () => await EditEmployee(@emp.EmployeeId))">Edit</button> | |
<button class="btn btn-danger" onclick="@(async () => await DeleteConfirm(@emp.EmployeeId))">Delete</button> | |
</td> | |
</tr> | |
} | |
</tbody> | |
</table> | |
if (isAdd) | |
{ | |
<div class="modal" tabindex="-1" style="display:block" role="dialog"> | |
<div class="modal-dialog"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<h3 class="modal-title">@modalTitle</h3> | |
<button type="button" class="close" onclick="@closeModal"> | |
<span aria-hidden="true">X</span> | |
</button> | |
</div> | |
<div class="modal-body"> | |
<form> | |
<div class="form-group"> | |
<label for="Name" class="control-label">Name</label> | |
<input for="Name" class="form-control" bind="@emp.Name" /> | |
</div> | |
<div class="form-group"> | |
<label asp-for="Gender" class="control-label">Gender</label> | |
<select asp-for="Gender" class="form-control" bind="@emp.Gender"> | |
<option value="">-- Select Gender --</option> | |
<option value="Male">Male</option> | |
<option value="Female">Female</option> | |
</select> | |
</div> | |
<div class="form-group"> | |
<label asp-for="Department" class="control-label">Department</label> | |
<input asp-for="Department" class="form-control" bind="@emp.Department" /> | |
</div> | |
<div class="form-group"> | |
<label asp-for="City" class="control-label">City</label> | |
<select asp-for="City" class="form-control" bind="@emp.City"> | |
<option value="">-- Select City --</option> | |
@foreach (var city in cityList) | |
{ | |
<option value="@city.CityName">@city.CityName</option> | |
} | |
</select> | |
</div> | |
</form> | |
</div> | |
<div class="modal-footer"> | |
<button class="btn btn-block btn-info" onclick="@(async () => await SaveEmployee())" data-dismiss="modal">Save</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
} | |
if (isDelete) | |
{ | |
<div class="modal" tabindex="-1" style="display:block" role="dialog"> | |
<div class="modal-dialog"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<h3 class="modal-title">Delete Employee</h3> | |
</div> | |
<div class="modal-body"> | |
<h4>Do you want to delete this employee ??</h4> | |
<table class="table"> | |
<tr> | |
<td>Name</td> | |
<td>@emp.Name</td> | |
</tr> | |
<tr> | |
<td>Gender</td> | |
<td>@emp.Gender</td> | |
</tr> | |
<tr> | |
<td>Department</td> | |
<td>@emp.Department</td> | |
</tr> | |
<tr> | |
<td>City</td> | |
<td>@emp.City</td> | |
</tr> | |
</table> | |
</div> | |
<div class="modal-footer"> | |
<button class="btn btn-danger" onclick="@(async () => await DeleteEmployee(emp.EmployeeId))" data-dismiss="modal">YES</button> | |
<button class="btn btn-warning" onclick="@closeModal">NO</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment