public IQueryable <Setting> Search(SettingSE se, bool isNoTracking = true, bool withoutDeleted = true) { var q = base.Search(se, isNoTracking, withoutDeleted); if (!String.IsNullOrEmpty(se.Name)) { q = q.Where(x => x.Name.Contains(se.Name)); } if (!String.IsNullOrEmpty(se.Value)) { q = q.Where(x => x.Value.Contains(se.Value)); } return(q); }
public IHttpActionResult Search(SettingSE se) { var page = new Page { PageSize = se.PageSize, PageNumber = se.PageNumber }; var settings = settingService.Search(se); int totalCount = settings.Count(); settings = settings.OrderByPropertyName(se.SortField, se.SortOrder); settings = settings.GetPage <Setting>(page); IEnumerable <SettingViewModel> settingViewModels = new List <SettingViewModel>(); Mapper.Map(settings, settingViewModels); PagedCollectionViewModel <SettingViewModel> viewModel = new PagedCollectionViewModel <SettingViewModel> { Data = settingViewModels, TotalCount = totalCount }; return(Ok(viewModel)); }
public IHttpActionResult Search(SettingSE se) { var page = new Page { PageSize = se.PageSize, PageNumber = se.PageNumber}; var settings = settingService.Search(se); int totalCount = settings.Count(); settings = settings.OrderByPropertyName(se.SortField, se.SortOrder); settings = settings.GetPage<Setting>(page); IEnumerable<SettingViewModel> settingViewModels = new List<SettingViewModel>(); Mapper.Map(settings, settingViewModels); PagedCollectionViewModel<SettingViewModel> viewModel = new PagedCollectionViewModel<SettingViewModel> { Data = settingViewModels, TotalCount = totalCount }; return Ok(viewModel); }