public IEnumerable<UserInfo> GetUserList(UserInfoCondition userCondition) { var userList = from user in this.DataSource.UserInfos where user.IsShow == true select user; if (!String.IsNullOrEmpty(userCondition.DisplayName)) { userList = userList.Where(u => u.DisplayName.Contains(userCondition.DisplayName)); } return userList.ToList(); }
// GET: UserManage public ActionResult Index(String name, Int32 pageIndex = 0) { if (!string.IsNullOrEmpty(name)) { name = name.Trim(); } UserManageIndexModel model = new UserManageIndexModel(); model.FilterName = name; UserInfoCondition condition = new UserInfoCondition(); condition.DisplayName = name; IEnumerable<UserInfo> users = this.IUserInfoDataProvider.GetUserList(condition); PagingContent<UserInfo> paging = new PagingContent<UserInfo>(users, pageIndex); foreach (var item in paging.EntityList) { model.userModelList.Add(UserModel.GetViewModel(item)); } model.PagingContent = paging; return View(model); }
public JsonResult JsonGetUserByName(string q) { List<UserModel> list = new List<UserModel>(); if (q.Length > 0) { UserInfoCondition condition = new UserInfoCondition(); condition.DisplayName = q; IEnumerable<UserInfo> users = this.IUserInfoDataProvider.GetUserList(condition); foreach (var item in users) { list.Add(UserModel.GetViewModel(item)); } } return Json(list, JsonRequestBehavior.AllowGet); }