09 04 2024
09 04 2024
{
Employee objEmp = new Employee();
*******************************************
public class Employee
{
[Key]
public int EmployeeId { get; set; }
public string EmployeeName { get; set; }
public string Gender { get; set; }
public int Salary { get; set; }
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.EmployeeId)
</th>
<th>
@Html.DisplayNameFor(model => model.EmployeeName)
</th>
<th>
@Html.DisplayNameFor(model => model.Gender)
</th>
<th>
@Html.DisplayNameFor(model => model.Salary)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.EmployeeId)
</td>
<td>
@Html.DisplayFor(modelItem => item.EmployeeName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Gender)
</td>
<td>
@Html.DisplayFor(modelItem => item.Salary)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ })
|
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey
*/ }) |
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */
})
</td>
</tr>
}
<a asp-action="Act1">Click</a>
@Html.ActionLink("Go to About","Index","About");
</tbody>
</table>
</body>
</html>