/// <summary> /// Set the lookups efficiently which are in the userLookupModel /// </summary> private static void SetLookups(UserLookupModel model, IRepository repository) { model.Applications = repository.OfType <Application>().Queryable.OrderBy(x => x.Name).Select( x => new KeyValuePair <int, string>(x.Id, x.Name)).ToList(); model.Units = repository.OfType <Unit>().Queryable.OrderBy(x => x.ShortName).Select( x => new KeyValuePair <int, string>(x.Id, x.ShortName)).ToList(); }
public ActionResult UserLookup(string idName, string valueName) { UserLookupModel model = new UserLookupModel { LookupInputId = idName, LookupInputIdValue = valueName }; return PartialView("UserLookup", model); }
public ActionResult UserLookup(UserLookupModel model) { model.Search(); return PartialView("UserLookup", model); }
public void UserLookupModel_Search_InValidExistingUser_NoItemsFound() { var model = new UserLookupModel { UserFullName = Guid.NewGuid().ToString(), UserFullNameOptions = "%{0}%" }; model.Search(Repository); Assert.IsFalse(model.SearchResults.Any()); }
public void UserLookupModel_Search_ValidExistingUser_ItemsFound() { var model = new UserLookupModel { UserFullName = "Mehlhorn", UserFullNameOptions = "%{0}%" }; model.Search(Repository); Assert.IsTrue(model.SearchResults.Any()); }
public void UserLookupModel_Search_NoInput_ItemsFound() { var model = new UserLookupModel(); model.Search(Repository); Assert.IsTrue(model.SearchResults.Any()); }