public UserPagingModel GetUserPagingModel(QueryOptions queryOptions, SearchObject searchObject) { var totalCount = 0; var users = _applicationUserService.GetUsers(queryOptions, searchObject, out totalCount); queryOptions.TotalPages = (int)Math.Ceiling((double)totalCount / queryOptions.PageSize); var resultList = new ResultList <ApplicationUser>(users, queryOptions); return(new UserPagingModel { UserEditModels = resultList, SearchObject = searchObject }); }
public RolePagingModel GetRolePagingModel(QueryOptions queryOptions, SearchObject searchObject) { var totalCount = 0; var roles = _applicationRoleService.GetRoles(queryOptions, searchObject, out totalCount); queryOptions.TotalPages = (int)Math.Ceiling((double)totalCount / queryOptions.PageSize); var roleEditModels = roles.Select(role => new RoleEditModel { Id = role.Id, Name = role.Name, Description = role.Description }).ToList(); return(new RolePagingModel { RoleEditModels = new ResultList <RoleEditModel>(roleEditModels, queryOptions), SearchObject = searchObject }); }