Searching Record in ASP.NET MVC (EF)
I'm trying to search a record but nothing is happen. Can anyone help me with this.
SignUp Controller
[code]
public ActionResult SearchUser(string userName)
{
var users = _SignUp.All()
.Select(user => new
{
userName = user.userName,
firstName = user.firstName,
middleName = user.middleName,
lastName = user.lastName
}
)
.Where(w => w.userName == userName)
.ToList();
return View(users);
}
[/code]
In my Index.cshtml
[code]
@model IEnumerable<mvcTraining.Data.ViewModel.UsersList>
@using (Html.BeginForm("SearchUser"))
{
<div>Enter Username to search:</div>
<input type="text" id="txtUsername" value="" />
<input type="submit" value="Search User" />
}
[/code]