I want to get list of users in my MVC.
Visual Studio keeps saying that I'm
"Use of unassigned local variable 'model' ".
I've tried different methods but can't fix the error. Can anyone tell me where I'm doing wrong?.
public ActionResult Search(string searchTerm)
{
var users = new DirectorySource<UserModel>(ROOT,SearchScope.Subtree);
IEnumerable<UserModel> model;
var res = from usr in users
where usr.DisplayName.StartsWith(searchTerm)
select usr.DisplayName;
foreach (var result in res)
{
model.OrderBy(p => p.DisplayName).ToList();
}
if (Request.IsAjaxRequest())
{
return PartialView("_search", model);
}
return View(model);
}