boycoto

boycoto

  • NA
  • 147
  • 123.2k

Searching Record in ASP.NET MVC (EF)

Dec 1 2012 3:14 AM
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]

Answers (1)