Atta Kumah

Atta Kumah

  • NA
  • 167
  • 12.2k

Developing an Employee ASP.NET MVC Base Application

Mar 31 2019 5:20 AM
I am Developing an Employee ASP.NET MVC Base Apllication, But the Problem is that I want to select a particular Employee Like the one Below without using the same page with the input form.
 
 Name  Sulon
 Address  Pibilla
 City  EmpireLodge
Submit
 Name Address City
Sulon        Pibila               EmpireLoge
Sulon        Pibilla              EmpireLoge
Sulon        Pibilla               EmpireLoge 
 
I want it that if An employee Enter His Details in One form, then He get the details in Another form. Please I need Help. Any Answer is highly appreciated.
public ActionResult Add_Record()
{
return View();
}
[HttpPost]
public ActionResult Add_Record(FormCollection FmC)
{
string user = FmC["Name"];
Employee Emp = new Employee();
Emp.Name = FmC["Name"];
Emp.Address = FmC["Address"];
Emp.City = FmC["City"];
Emp.Pin_Code = FmC["Pin_Code"];
Emp.Designation = FmC["Designation"];
DAlayer.AddDetails(Emp);
var Data = USB.tbl_Employee.Where(x => x.Name == user);
return View(Data);
//return RedirectToAction("SRD");
}
View State
@model IEnumerable<AttaK.Models.tbl_Employee>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Add_Record</title>
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<div>
<form method="post">
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">Name </label>
<div class="col-sm-9">
<input type="text" name="Name" class="col-xs-10" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">Address </label>
<div class="col-sm-9">
<input type="text" name="Address" class="col-xs-10" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">City</label>
<div class="col-sm-9">
<input type="text" name="City" class="col-xs-10" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">Pin_Code</label>
<div class="col-sm-9">
<input type="text" name="Pin_Code" class="col-xs-10" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">Designation </label>
<div class="col-sm-9">
<input type="text" name="Designation" class="col-xs-10" />
</div>
</div>
<div class="form-group">
<div class="col-sm-9">
<input type="submit" name="Submit" class="btn btn-primary" />
</div>
</div>
</form>
</div>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Address)
</th>
<th>
@Html.DisplayNameFor(model => model.City)
</th>
<th>
@Html.DisplayNameFor(model => model.Pin_Code)
</th>
<th>
@Html.DisplayNameFor(model => model.Designation)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Address)
</td>
<td>
@Html.DisplayFor(modelItem => item.City)
</td>
<td>
@Html.DisplayFor(modelItem => item.Pin_Code)
</td>
<td>
@Html.DisplayFor(modelItem => item.Designation)
</td>
</tr>
}
</table>
</body>
</html>
 

Answers (1)