/// <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();
 }
Example #2
0
 public ActionResult UserLookup(string idName, string valueName)
 {
     UserLookupModel model = new UserLookupModel
     {
         LookupInputId = idName,
         LookupInputIdValue = valueName
     };
     
     return PartialView("UserLookup", model);
 }
Example #3
0
 public ActionResult UserLookup(UserLookupModel model)
 {
     model.Search();
     return PartialView("UserLookup", model);
 }
Example #4
0
 public void UserLookupModel_Search_InValidExistingUser_NoItemsFound()
 {
     var model = new UserLookupModel { UserFullName = Guid.NewGuid().ToString(), UserFullNameOptions = "%{0}%" };
     model.Search(Repository);
     Assert.IsFalse(model.SearchResults.Any());
 }
Example #5
0
 public void UserLookupModel_Search_ValidExistingUser_ItemsFound()
 {
     var model = new UserLookupModel { UserFullName = "Mehlhorn", UserFullNameOptions = "%{0}%" };
     model.Search(Repository);
     Assert.IsTrue(model.SearchResults.Any());
 }
Example #6
0
 public void UserLookupModel_Search_NoInput_ItemsFound()
 {
     var model = new UserLookupModel();
     model.Search(Repository);
     Assert.IsTrue(model.SearchResults.Any());
 }