public IEnumerable<AuthorInfo> GetAuthorList(AuthorInfoCondition authorCondition) { var authorList = from author in this.DataSource.AuthorInfos select author; if (!String.IsNullOrEmpty(authorCondition.AuthorName)) { authorList = authorList.Where(u => u.AuthorName.Contains(authorCondition.AuthorName)); } return authorList.ToList(); }
// GET: AuthorManage public ActionResult Index(String name, Int32 pageIndex = 0) { if (!string.IsNullOrEmpty(name)) { name = name.Trim(); } AuthorManageIndexModel model = new AuthorManageIndexModel(); model.FilterName = name; AuthorInfoCondition condition = new AuthorInfoCondition(); condition.AuthorName = name; IEnumerable<AuthorInfo> AuthorList = this.IAuthorInfoDataProvider.GetAuthorList(condition); PagingContent<AuthorInfo> paging = new PagingContent<AuthorInfo>(AuthorList, pageIndex); foreach (var item in paging.EntityList) { model.AuthorModelList.Add(AuthorModel.GetViewModel(item)); } model.PagingContent = paging; return View(model); }
public JsonResult JsonGetAuthorByName(string q) { List<AuthorModel> list = new List<AuthorModel>(); if (q.Length > 0) { AuthorInfoCondition condition = new AuthorInfoCondition(); condition.AuthorName = q; IEnumerable<AuthorInfo> AuthorList = this.IAuthorInfoDataProvider.GetAuthorList(condition); foreach (var item in AuthorList) { list.Add(AuthorModel.GetViewModel(item)); } } return Json(list, JsonRequestBehavior.AllowGet); }