public async Task <IActionResult> MyApplications(JobApplicationSearchViewModel jvm) { jvm.SearchResults = await jobApplicationRepository.GetPaged(s => s.CreatedBy == User.Identity.Name && (!String.IsNullOrEmpty(jvm.Keywords) ? s.Job.Title.Contains(jvm.Keywords) : true), o => o.Job.Title, false, 10, jvm.Page, "Job", "Resume", "Job.Company", "Resume.Location"); ViewBag.Locations = new SelectList(locationRepository.GetAll().OrderBy(o => o.Name).ToList(), "Id", "Name", jvm); return(View(jvm)); }
public void Simple_Repo_GetPaged_Should_Allow_Descending_Order() { GivenShwerkosWithNames("aaa", "bbb", "a"); var paged = _repo.GetPaged <Shwerko>("Name desc", 0, 1); Assert.Equal("bbb", paged[0].Name); }
public async Task <IActionResult> Index(ResumeSearchViewModel vm) { vm.SearchResults = await resumeRepository.GetPaged(s => (!String.IsNullOrEmpty(vm.Keywords) ? s.FullName.Contains(vm.Keywords) : true) && (!String.IsNullOrEmpty(vm.LocationId) ? s.LocationId == vm.LocationId : true) && (vm.MilitaryStatus.HasValue ? s.MilitaryStatus == vm.MilitaryStatus : true) && (vm.EducationLevel.HasValue ? s.EducationInfos.Any(e => e.EducationLevel == vm.EducationLevel) : true), s => (vm.SortBy == 1 || vm.SortBy == 2 ? s.FullName:(vm.SortBy == 3 || vm.SortBy == 4 ? s.UpdateDate.ToString("yyyy-MM-dd 0:HH:mm") :(vm.SortBy == 5 || vm.SortBy == 6 ? s.Location.Name:s.UpdateDate.ToString()))), (vm.SortBy == 1 || vm.SortBy == 3 || vm.SortBy == 5?false:(vm.SortBy == 2 || vm.SortBy == 4 || vm.SortBy == 6)), 2, vm.Page, "EducationInfos", "Location"); vm.SearchResults.RouteValue = new RouteValueDictionary { { "Keywords", vm.Keywords }, { "LocationId", vm.LocationId }, { "MilitaryStatus", vm.MilitaryStatus }, { "EducationLevel", vm.EducationLevel }, { "SortBy", vm.SortBy } }; ViewBag.Locations = new SelectList(locationRepository.GetAll().OrderBy(o => o.Name).ToList(), "Id", "Name", vm.LocationId); ViewBag.Occupations = new SelectList(occupationRepository.GetAll().OrderBy(p => p.Name).ToList(), "Id", "Name", vm.OccupationId); return(View(vm)); }
public async Task <IActionResult> Index(JobSearchViewModel jvm) { jvm.SearchResults = await jobRepository.GetPaged(s => s.IsActive == true && s.PublishDate <= DateTime.Now && DateTime.Now <= s.EndDate && (!String.IsNullOrEmpty(jvm.Keywords) ? s.Title.Contains(jvm.Keywords) : true) && (!String.IsNullOrEmpty(jvm.LocationId) ? s.JobLocations.Any(l => l.LocationId == jvm.LocationId) : true) && (jvm.MilitaryStatus.HasValue ? s.MilitaryStatus == jvm.MilitaryStatus : true) && (jvm.EducationLevel.HasValue ? s.EducationLevel == jvm.EducationLevel : true) && (jvm.WorkingStyle.HasValue ? s.WorkingStyle == jvm.WorkingStyle : true), s => (jvm.SortBy == 1 || jvm.SortBy == 2 ? s.Title : (jvm.SortBy == 3 || jvm.SortBy == 4 ? s.PublishDate.ToString("yyyy-MM-dd") : (jvm.SortBy == 5 || jvm.SortBy == 6 ? s.Company.LocationId: s.UpdateDate.ToString()))), (jvm.SortBy == 1 || jvm.SortBy == 3 || jvm.SortBy == 5 ? false : (jvm.SortBy == 2 || jvm.SortBy == 4 || jvm.SortBy == 6)), 5, jvm.Page, "Company", "JobLocations", "JobLocations.Location"); jvm.SearchResults.RouteValue = new RouteValueDictionary { { "keywords", jvm.Keywords }, { "locationId", jvm.LocationId }, { "sortBy", jvm.SortBy }, { "militaryStatus", jvm.MilitaryStatus }, { "educationLevel", jvm.EducationLevel }, { "workingStyle", jvm.WorkingStyle } }; ViewBag.Locations = new SelectList(locationRepository.GetAll().OrderBy(o => o.Name).ToList(), "Id", "Name", jvm.LocationId); ViewBag.Occupations = new SelectList(occupationRepository.GetAll().OrderBy(p => p.Name).ToList(), "Id", "Name", jvm.OccupationId); return(View(jvm)); }
public Page <TomJob> GetPaged() { return(_repository.GetPaged(new Page <TomJob>() { PageIndex = 2, PageSize = 3 })); }
/// <summary> /// Lists all the albums associated with the UserID or gets all the /// specifications for the specified album id. /// </summary> /// <param name="repository"> /// The repository. /// </param> /// <param name="userId"> /// The user Id. /// </param> /// <param name="pageIndex"> /// The page Index. /// </param> /// <param name="pageSize"> /// The page Size. /// </param> /// <returns> /// The <see cref="List"/>. /// </returns> public static List <UserAlbum> ListByUserPaged([NotNull] this IRepository <UserAlbum> repository, [NotNull] int userId, [NotNull] int pageIndex, [NotNull] int pageSize) { CodeContracts.VerifyNotNull(repository); return(repository.GetPaged(userAlbum => userAlbum.UserID == userId, pageIndex, pageSize) .OrderByDescending(u => u.Updated).ToList()); }
/// <summary> /// 问卷列表 /// </summary> /// <param name="model"></param> /// <returns></returns> public SurveyDirectoryViewModel GetPaged(SurveyDirectoryViewModel model) { model.Conditions = " where (@surveystate ='-1' OR SurveyState=@surveystate) AND (@surveyname='' OR SurveyName =@surveyname) and Uid=@uid and IsValid =1"; model.Parameters = new { surveystate = model.QuerySurveyState, surveyname = Utils.HtmlEncode(Utils.UrlDecode(model.QuerySurveyName)), uid = model.Uid }; model.Items = _repository.GetPaged(model.Current).Items; return(model); }
public async Task <GetAbusePages.Response> GetAbusePages(GetAbusePages.Request request, CancellationToken cancellationToken) { var total = await _repository.Count(cancellationToken); if (total == 0) { return(new GetAbusePages.Response { Total = 0, Offset = request.Offset, Limit = request.Limit }); } var abuses = await _repository.GetPaged(a => a.RemovedDate == null, request.Offset, request.Limit, cancellationToken); total = await _repository.Count(a => a.RemovedDate == null, cancellationToken); return(new GetAbusePages.Response { Items = abuses.Select(a => new GetAbusePages.Response.Item { Id = a.Id, AuthorId = a.AuthorId, AbuseAdvId = a.AbuseAdvId, Priority = a.Priority, AbuseText = a.AbuseText, RemovedDate = a.RemovedDate }), Total = total, Offset = request.Offset, Limit = request.Limit }); }
public override PagedList <TViewModel> Get([FromUri] TQuery info) { int pageIndex, pageSize; return(_repository.GetPaged(GetQueryParams(info, out pageIndex, out pageSize), pageIndex, pageSize) .Map <PagedList <TEntity>, PagedList <TViewModel> >()); }
public async Task <IActionResult> Index(CompanySearchViewModel cvm) { //s => (vm.SortBy == 1 || vm.SortBy == 2 ? s.FullName : (vm.SortBy == 3 || vm.SortBy == 4 ? s.Occupation.Name : (vm.SortBy == 5 || vm.SortBy == 6 ? s.Location.Name : s.UpdateDate.ToString()))), (vm.SortBy == 1 || vm.SortBy == 3 || vm.SortBy == 5 ? false : (vm.SortBy == 2 || vm.SortBy == 4 || vm.SortBy == 6) cvm.SearchResults = await companyRepository.GetPaged(s => (!String.IsNullOrEmpty(cvm.Keywords) ? s.Name.Contains(cvm.Keywords) : true) && (!String.IsNullOrEmpty(cvm.LocationId) ? s.LocationId == cvm.LocationId: true) && (!String.IsNullOrEmpty(cvm.SectorId) ? s.SectorId == cvm.SectorId : true), s => (cvm.SortBy == 1 || cvm.SortBy == 2 ? s.Name : (cvm.SortBy == 3 || cvm.SortBy == 4 ? s.Sector.Name : (cvm.SortBy == 5 || cvm.SortBy == 6 ? s.Location.Name : s.UpdateDate.ToString()))), (cvm.SortBy == 1 || cvm.SortBy == 3 || cvm.SortBy == 5 ? false : (cvm.SortBy == 2 || cvm.SortBy == 4 || cvm.SortBy == 6)), 5, cvm.Page, "Jobs", "Location"); ViewBag.Locations = new SelectList(locationRepository.GetAll().OrderBy(o => o.Name).ToList(), "Id", "Name", cvm.LocationId); ViewBag.Sector = new SelectList(sectorRepository.GetAll().OrderBy(p => p.Name).ToList(), "Id", "Name", cvm.SectorId); return(View(cvm)); }
public List <ArticleDto> GetList(QueryDto queryDto) { queryDto.offset = string.IsNullOrEmpty(queryDto.offset) ? "0" : queryDto.offset; queryDto.limit = string.IsNullOrEmpty(queryDto.limit) ? "20" : queryDto.limit; var articlelist = _articleRep.GetPaged(int.Parse(queryDto.offset), int.Parse(queryDto.limit), p => p.Id, u => u.Title.IndexOf(queryDto.key) > 0, false); return(_mapper.Map <List <ArticleDto> >(articlelist)); }
public List <UserDto> GetList(QueryDto queryDto) { queryDto.offset = string.IsNullOrEmpty(queryDto.offset) ? "0" : queryDto.offset; queryDto.limit = string.IsNullOrEmpty(queryDto.limit) ? "20" : queryDto.limit; var userlist = _userRep.GetPaged(int.Parse(queryDto.offset), int.Parse(queryDto.limit), p => p.Id, u => u.Name.IndexOf(queryDto.key) > 0, false); return(_mapper.Map <List <UserDto> >(userlist)); }
/// <summary> /// Lists all the images associated with the Album Id. /// </summary> /// <param name="repository"> /// The repository. /// </param> /// <param name="albumId"> /// The album Id. /// </param> /// <param name="pageIndex"> /// The page Index. /// </param> /// <param name="pageSize"> /// The page Size. /// </param> /// <returns> /// a Data table containing the image(s). /// </returns> public static List <UserAlbumImage> ListPaged( [NotNull] this IRepository <UserAlbumImage> repository, [NotNull] int albumId, [NotNull] int pageIndex, [NotNull] int pageSize) { CodeContracts.VerifyNotNull(repository); return(repository.GetPaged(albumImage => albumImage.AlbumID == albumId, pageIndex, pageSize) .OrderByDescending(a => a.Uploaded).ToList()); }
public ActionResult Index(int pageNumber = 1) { var recipesList = _recipeRepository.GetPaged(5, pageNumber); var vm = new RecipesVM() { Recipes = recipesList.Payload, TotalRecipes = recipesList.TotalItems, PagesToShow = recipesList.TotalPages }; return(View(vm)); }
public void GetPagedTest() { int total = 0; var lstResult = repository.GetPaged("Sys_Role", "", "RoleName='管理员'", "", 1, 20, 0, out total); if (lstResult != null && lstResult.Any()) { Console.WriteLine(lstResult.Count()); } else { Console.WriteLine("没有查到值"); } }
public void GetPagedTest() { int total = 0; var lstResult = repository.GetPaged("Sys_Privilege", "", "PrivilegeMasterKey='cf9d52cc-0500-4829-9611-fd0056961488'", "", 1, 20, 0, out total); if (lstResult != null && lstResult.Any()) { Console.WriteLine(lstResult.Count()); } else { Console.WriteLine("没有查到值"); } }
public void GetPagedTest() { int total = 0; var lstResult = repository.GetPaged("Sys_DataPrivilege", "", "DataPrivilegeView='View2'", "", 1, 20, 0, out total); if (lstResult != null && lstResult.Any()) { Console.WriteLine(lstResult.Count()); } else { Console.WriteLine("没有查到值"); } }
public async Task <IActionResult> GetSupplyType([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "supply-type")] HttpRequest req) { try { if (req.Body is null) { throw new NullReferenceException(); } else if (await IsTokenValid(req)) { int.TryParse(req.Query["page"], out int page); PagedList <SupplyType> supplyTypes = await ISupplyType.GetPaged(page); return(new OkObjectResult(new Response(true, string.Empty, supplyTypes))); } else { return(new UnauthorizedResult()); } } catch (Exception ex) { throw new Exception("Oops! Something went wrong!", new Exception(ex.Message)); } }
public virtual IEnumerable <TEntity> GetPaged <KProperty>(int pageIndex, int pageCount, System.Linq.Expressions.Expression <System.Func <TEntity, KProperty> > orderByExpression, bool ascending) { return(_repository.GetPaged <KProperty>(pageIndex, pageCount, orderByExpression, ascending)); }
public IEnumerable <T> GetPaged <Property>(int pageIndex, int pageCount, System.Linq.Expressions.Expression <Func <T, Property> > orderByExpression, bool ascending) { return(Repository.GetPaged <Property>(pageIndex, pageCount, orderByExpression, ascending)); }
public virtual IEnumerable <TViewModel> GetPaged(int page, int pageSize) { return(Mapper.Map <IEnumerable <TModel>, IEnumerable <TViewModel> >(Repository.GetPaged(x => x.CriadoEm, page, pageSize))); }
private static void ForceMigration(IRepository repository) { repository.GetPaged<Series>(0, 1); repository.GetPaged<EpisodeInfo>(0, 1); }
public Page <SurveyAnswer> GetPageSurveyAnswer(Page <SurveyAnswer> page) { return(_repository.GetPaged(page)); }
private static void ForceMigration(IRepository repository) { repository.GetPaged<Category>(0, 1); repository.GetPaged<History>(0, 1); repository.GetPaged<Server>(0, 1); }
/// <summary> /// 分页获取列表 /// </summary> /// <param name="pi">分页列表</param> /// <param name="specification">查询条件</param> /// <param name="sortPredicate">排序字段</param> /// <param name="sortOrder">排序方式</param> /// <returns>实体列表</returns> public virtual List <T> GetPage <T>(PageInfo pi, ISpecification <T> specification, Expression <Func <T, dynamic> > sortPredicate, SortOrder sortOrder) where T : AggregateRoot, new() { pi.Total = _dbContext.GetAll(specification).Count(); return(_dbContext.GetPaged <T>(pi.PageIndex, pi.PageSize, specification, sortPredicate, sortOrder).ToList()); }
protected virtual IPagedCollection LoadCollection(IFilter <T, TKey> filter) { return(repository.GetPaged(filter)); }
public PagedList <TEntity> GetPaged(Expression <Func <TEntity, bool> > predicate, int pageIndex = 1, int pageSize = 15, SortExpression <TEntity> sortExpression = null) { return(Instance.GetPaged(predicate, pageIndex, pageSize, sortExpression)); }
private static void ForceMigration(IRepository repository) { repository.GetPaged <Category>(0, 1); repository.GetPaged <History>(0, 1); repository.GetPaged <Server>(0, 1); }
public PagedList <TModel> PageSearch(PageInfo page, TSearch search, TOrder order) { return(Repository.GetPaged(page.PageIndex, page.PageSize, GetFilter(search), new SortExpression <TEntity>(GetOrder(order))).ConvertToPagedList(item => Convert(item))); }