public async Task <Page <EmployeeViewData> > GetPaginatedResultsAsync( int pageSize, int currentPage, string searchText, EmployeeSearchOptions sortBy, EmployeeSearchOptions searchBy) { var filters = new Filters <EmployeeViewData>(); switch (searchBy) { case EmployeeSearchOptions.LastName: filters.Add(!string.IsNullOrEmpty(searchText), x => x.LastName.Contains(searchText)); break; case EmployeeSearchOptions.FirstName: default: filters.Add(!string.IsNullOrEmpty(searchText), x => x.FirstName.Contains(searchText)); break; } var sorts = new Sorts <EmployeeViewData>(); sorts.Add(sortBy == EmployeeSearchOptions.FirstName, x => x.FirstName); sorts.Add(sortBy == EmployeeSearchOptions.LastName, x => x.LastName); return(await _dbContext.Employees .Select(e => _mapper.MapToViewModel(e)) .PaginateAsync(currentPage, pageSize, sorts, filters)); }
private void sortGroups(ref List <AttributeGroupDTO> groups, Sorts s) { switch (s) { case Sorts.ArabicNameDown: groups.Sort((a, b) => - 1 * a.ArabicName.CompareTo(b.ArabicName)); //products.OrderBy(op => op.Name); break; case Sorts.ArabicNameUp: groups.Sort((a, b) => a.ArabicName.CompareTo(b.ArabicName)); break; case Sorts.EnglishNameDown: groups.Sort((a, b) => - 1 * a.EnglishName.CompareTo(b.EnglishName)); //products.OrderBy(op => op.Price); break; case Sorts.EnglishNameUp: groups.Sort((a, b) => a.EnglishName.CompareTo(b.EnglishName)); break; case Sorts.IdDown: groups.Sort((a, b) => - 1 * a.Id.CompareTo(b.Id)); break; case Sorts.IdUp: groups.Sort((a, b) => a.Id.CompareTo(b.Id)); break; //case Sorts.StatusDown: groups.Sort((a, b) => -1 * a.Status.CompareTo(b.Status)); // break; //case Sorts.StatusUp: groups.Sort((a, b) => a.Status.CompareTo(b.Status)); // break; } }
public Page <Employee> GetFilteredEmployees(int pageSize, int currentPage, string searchText, int sortBy, string jobTitle) { Page <Employee> employees; var filters = new Filters <Employee>(); filters.Add(!string.IsNullOrEmpty(searchText), x => x.LoginID.Contains(searchText)); filters.Add(!string.IsNullOrEmpty(jobTitle), x => x.JobTitle.Equals(jobTitle)); var sorts = new Sorts <Employee>(); //Example without priority. //sorts.Add(sortBy == 2, x => x.LoginID); //sorts.Add(sortBy == 1, x => x.BusinessEntityID); //sorts.Add(sortBy == 3, x => x.JobTitle); sorts.Add(sortBy == 3, x => x.JobTitle, false, 1); sorts.Add(sortBy == 1, x => x.BusinessEntityID, true, 2); sorts.Add(true, x => x.LoginID, true, 3); using (var context = new AdventureWorksEntities()) { employees = context.Employees.Paginate(currentPage, pageSize, sorts, filters); } return(employees); }
private void SetOrderByForMember(MemberExpression memberExp, LambdaExpression fullExpression, SortType sortType) { if (memberExp.Expression.NodeType == ExpressionType.MemberAccess) { //分组查询 if (IsGroupBy) { var descriptor = GroupByPropertyList.FirstOrDefault(m => m.Alias == memberExp.Member.Name); if (descriptor != null) { var colName = GetColumnName(descriptor.Name, descriptor.JoinDescriptor); Sorts.Add(new Sort(colName, sortType)); } } else { if (memberExp.Expression.Type.IsString()) { var memberName = memberExp.Member.Name.Equals("Length"); //解析Length函数 if (memberName) { var funcName = _sqlAdapter.FuncLength; var colName = GetColumnName(memberExp.Expression as MemberExpression, fullExpression); Sorts.Add(new Sort($"{funcName}({colName})", sortType)); } } } } else { var colName = GetColumnName(memberExp, fullExpression); Sorts.Add(new Sort(colName, sortType)); } }
public Page <STUDENT> FilterStudent(int PageSize, int CurrentPage, string SearchText, int SortBy, string Department) { /* * PageSize - no. of records * CurrentPage - Page no. * SearchText - Student Name only * SortBy - drop down for section (value returned=1) sem(2) USN(3) * Department - dropdown department name. (value returned should be dept name) */ Page <STUDENT> students; var filters = new Filters <STUDENT>(); filters.Add(!string.IsNullOrEmpty(SearchText), x => x.NAME.Contains(SearchText)); filters.Add(!string.IsNullOrEmpty(SearchText), x => x.DEPT.DeptName.Equals(Department)); var sorts = new Sorts <STUDENT>(); sorts.Add(SortBy == 1, x => x.Section, true); sorts.Add(SortBy == 2, x => x.Sem, true); sorts.Add(SortBy == 3, x => x.USN, true); using (var Context = new RNSITEntities()) { students = Context.STUDENTs.Paginate(CurrentPage, PageSize, sorts, filters); } return(students); }
async Task SendLastUpdatedContentsAsync() { try { var filterBy = Filters <Content> .And( Filters <Content> .Equals("Status", $"{ApprovalStatus.Published}"), Filters <Content> .GreaterOrEquals("StartingTime", "@nowHourQuater()"), Filters <Content> .Or( Filters <Content> .Equals("EndingTime", "-"), Filters <Content> .LessThan("EndingTime", "@nowHourQuater()") ), Filters <Content> .IsNull("ParentID") ); Func <string> func_GetNowHourQuater = () => this.GetNowHourQuater().ToDTString(); filterBy.Prepare(null, null, new Dictionary <string, object> { { "nowHourQuater", func_GetNowHourQuater } }); var sortBy = Sorts <Content> .Descending("StartingTime").ThenByDescending("LastUpdated"); var objects = await Content.FindAsync(filterBy, sortBy, 20, 1, $"{this.GetCacheKey(filterBy, sortBy)}:1", this.CancellationTokenSource.Token).ConfigureAwait(false); var messages = objects.Select(content => new BaseMessage { Type = $"{this.ServiceName}#Content#Update", Data = content.ToJson() }).ToList(); await this.SendUpdateMessagesAsync(messages, "*", null, this.CancellationTokenSource.Token).ConfigureAwait(false); } catch { } }
public Sort(Sorts sortilege, int coutMana, int puissance) { m_Niveau = 1; m_CoutMana = coutMana; m_Sortilege = sortilege; m_Puissance = puissance; }
public Page <Employee> GetEmployeeReport(int pageSize, int currentPage, string searchText, int sortBy, string jobPosition, string empDepartment) { Page <Employee> employees; var filters = new Filters <Employee>(); filters.Add(!string.IsNullOrEmpty(searchText), x => x.Firstname.Contains(searchText)); filters.Add(!string.IsNullOrEmpty(jobPosition), x => x.JobTitle.Equals(jobPosition)); filters.Add(!string.IsNullOrEmpty(empDepartment), x => x.Department.Equals(empDepartment)); var sorts = new Sorts <Employee>(); //Example without priority. //sorts.Add(sortBy == 2, x => x.LoginID); //sorts.Add(sortBy == 1, x => x.BusinessEntityID); //sorts.Add(sortBy == 3, x => x.JobTitle); sorts.Add(sortBy == 3, x => x.JobTitle, false, 1); sorts.Add(sortBy == 1, x => x.Department, true, 2); sorts.Add(true, x => x.Firstname, true, 3); employees = _context.Employees.Paginate(currentPage, pageSize, sorts, filters); return(employees); }
public void QuickSortTest() { var arr = new int[] { 10, 5, 3, 12, 45, 90, 110, 100, 120 }; var expect = new int[] { 3, 5, 10, 12, 45, 90, 100, 110, 120 }; Assert.Equal(expect, Sorts.QuickSort(arr, 0, 8)); }
public async Task <TransactionHistoryPage <TransactionHistory> > GetEvents(TransactionHistoryQuery transactionHistoryQuery) { if (transactionHistoryQuery.From != null) { transactionHistoryQuery.From = transactionHistoryQuery.From.Value.ToUniversalTime(); } if (transactionHistoryQuery.To != null) { transactionHistoryQuery.To = transactionHistoryQuery.To.Value.ToUniversalTime(); } var sorts = new Sorts <Data.Models.TransactionHistory>(); sorts.Add(true, x => x.OccuredAt, true); var filters = new Filters <Data.Models.TransactionHistory>(); filters.Add(!string.IsNullOrEmpty(transactionHistoryQuery.NodeId), x => x.NodeId == transactionHistoryQuery.NodeId); filters.Add(transactionHistoryQuery.NodeIds != null && transactionHistoryQuery.NodeIds.Any(), x => transactionHistoryQuery.NodeIds.Contains(x.NodeId)); filters.Add(transactionHistoryQuery.From != null, x => x.OccuredAt > transactionHistoryQuery.From); filters.Add(transactionHistoryQuery.To != null, x => x.OccuredAt < transactionHistoryQuery.To); var result = await _transactionHistoryRepository.GetTransactionHistory(transactionHistoryQuery.CurrentPage, transactionHistoryQuery.PageSize, sorts, filters); return(_mapper.Map <TransactionHistoryPage <TransactionHistory> >(result)); }
private void sortCategories(ref List <CategoryManegerDTO> categories, Sorts s) { switch (s) { case Sorts.ArabicNameDown: categories.Sort((a, b) => - 1 * a.ArabicName.CompareTo(b.ArabicName)); //products.OrderBy(op => op.Name); break; case Sorts.ArabicNameUp: categories.Sort((a, b) => a.ArabicName.CompareTo(b.ArabicName)); break; case Sorts.EnglishNameDown: categories.Sort((a, b) => - 1 * a.EnglishName.CompareTo(b.EnglishName)); //products.OrderBy(op => op.Price); break; case Sorts.EnglishNameUp: categories.Sort((a, b) => a.EnglishName.CompareTo(b.EnglishName)); break; case Sorts.IdDown: categories.Sort((a, b) => - 1 * a.Id.CompareTo(b.Id)); break; case Sorts.IdUp: categories.Sort((a, b) => a.Id.CompareTo(b.Id)); break; case Sorts.StatusDown: categories.Sort((a, b) => - 1 * a.Status.CompareTo(b.Status)); break; case Sorts.StatusUp: categories.Sort((a, b) => a.Status.CompareTo(b.Status)); break; } }
private void sortDiscounts(ref List <DiscountDTO> options, Sorts s) { switch (s) { case Sorts.ArabicNameDown: options.Sort((a, b) => - 1 * a.ArabicName.CompareTo(b.ArabicName)); break; case Sorts.ArabicNameUp: options.Sort((a, b) => a.ArabicName.CompareTo(b.ArabicName)); break; case Sorts.EnglishNameDown: options.Sort((a, b) => - 1 * a.EnglishName.CompareTo(b.EnglishName)); break; case Sorts.EnglishNameUp: options.Sort((a, b) => a.EnglishName.CompareTo(b.EnglishName)); break; case Sorts.IdDown: options.Sort((a, b) => - 1 * a.Id.CompareTo(b.Id)); break; case Sorts.IdUp: options.Sort((a, b) => a.Id.CompareTo(b.Id)); break; case Sorts.StatusDown: options.Sort((a, b) => - 1 * a.IsPercentage.CompareTo(b.IsPercentage)); break; case Sorts.StatusUp: options.Sort((a, b) => a.IsPercentage.CompareTo(b.IsPercentage)); break; case Sorts.ValueDown: options.Sort((a, b) => - 1 * a.Value.CompareTo(b.Value)); break; case Sorts.ValueUp: options.Sort((a, b) => a.Value.CompareTo(b.Value)); break; } }
public void MergeSortTest() { var arr = new int[] { 10, 5, 3, 12, 45 }; var expect = new int[] { 3, 5, 10, 12, 45 }; Assert.Equal(expect, Sorts.MergeSort(arr)); }
public async Task <IActionResult> PutSorts([FromRoute] Guid id, [FromBody] Sorts sorts) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != sorts.Id) { return(BadRequest()); } _context.Entry(sorts).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SortsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public JsonResult UserTypeTableAjax(JQueryDataTableParamModel param) { #region byDefaultReturnData int rowCount = 0; int lnRowCount = 0; var result = from q in new List <UserType>() select new { q.Id, q.Name }; #endregion var oUserType = new UserType(); if (!string.IsNullOrEmpty(Request.QueryString["Name"])) { oUserType.Name = Request.QueryString["Name"]; } DataTableProcessModel m = new DataTableProcessModel(); DataTableProcessModel dtProcess = DataTableProcesses.DataTableEslestir(param, m); //oUserType.SortCol = dtProcess.SortCol; //oUserType.SortType = dtProcess.SortType; //oUserType.Page = dtProcess.Page; //oUserType.RowPerPage = dtProcess.RowPerPage; //var oResultModel = DAL.Account.UserType.GetUserType(oUserType); var filters = new Filters <UserType>(); //filters.Add(Convert.ToBoolean(oUserType.Name), x => x.Name == oUserType.Name); filters.Add(true, x => x.IsDeleted == false); var sorts = new Sorts <UserType>(); sorts.Add(dtProcess.SortCol == "Id", x => x.Name); var getUsers = _db.UserTypes.Paginate(dtProcess.Page, dtProcess.RowPerPage, sorts, filters); if (getUsers.RecordCount > 0) { var lstUserType = getUsers.Results; rowCount = getUsers.RecordCount; lnRowCount = rowCount; result = from q in lstUserType select new { q.Id, q.Name }; } return(Json(new { param.sEcho, iTotalRecords = rowCount, iTotalDisplayRecords = lnRowCount, aaData = result }, JsonRequestBehavior.AllowGet)); }
public async Task <IHttpActionResult> PutSorts(int id, Sorts sorts) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != sorts.Id_sorts) { return(BadRequest()); } db.Entry(sorts).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SortsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public List <UserDTO> Filter(string fName, string email, Sorts s) { List <string> usersIds = db.Users.ToList().Select(c => c.Id).ToList(); if (!String.IsNullOrEmpty(fName)) { List <string> ids = db.Users.ToList().Where(c => (c.FirstName + " " + c.LastName).ToLower().Contains(fName.ToLower())).Select(c => c.Id).ToList();; usersIds = usersIds.Intersect(ids).ToList(); } if (!String.IsNullOrEmpty(email)) { List <string> ids = db.Users.ToList().Where(c => c.Email.ToLower().Contains(email.ToLower())).Select(c => c.Id).ToList();; usersIds = usersIds.Intersect(ids).ToList(); } var users = db.Users.ToList().Where(c => usersIds.Contains(c.Id)).ToList(); var usersDtos = new List <UserDTO>(); foreach (var user in users) { var userDto = new UserDTO(); userDto.Email = user.Email; userDto.FirstName = user.FirstName; userDto.LastName = user.LastName; userDto.AccountLock = user.LockoutEnabled; userDto.AccountStatus = user.EmailConfirmed; userDto.Id = user.Id; userDto.UserName = user.UserName; usersDtos.Add(userDto); } // return usersDtos; sortUsers(ref usersDtos, s); return(usersDtos); }
public void Sort_Tests(int[,] array, Sorts strategy, SortOrder sortOrder, int[,] expectedArray) { SortContext sortContext = new SortContext(strategy); sortContext.ExecuteSort(array, sortOrder); Assert.AreEqual(array, expectedArray); }
private void sortUsers(ref List <UserDTO> users, Sorts s) { switch (s) { case Sorts.EmailDown: users.Sort((a, b) => - 1 * a.Email.CompareTo(b.Email)); break; case Sorts.EmailUp: users.Sort((a, b) => a.Email.CompareTo(b.Email)); break; case Sorts.CustomerNameDown: users.Sort((a, b) => - 1 * a.FullName.CompareTo(b.FirstName)); break; case Sorts.CustomerNameUp: users.Sort((a, b) => a.FullName.CompareTo(b.FirstName)); break; case Sorts.StatusUp: users.Sort((a, b) => a.AccountStatus.CompareTo(b.AccountStatus)); //products.OrderBy(op => op.Price); break; case Sorts.StatusDown: users.Sort((a, b) => - 1 * a.AccountStatus.CompareTo(b.AccountStatus)); break; case Sorts.lockedUp: users.Sort((a, b) => a.AccountLock.CompareTo(b.AccountLock)); //products.OrderBy(op => op.Price); break; case Sorts.lockedDown: users.Sort((a, b) => - 1 * a.AccountLock.CompareTo(b.AccountLock)); break; } }
public async Task <HttpResponseMessage> GetAllPeopleAsync(string name, string last = "", string ascDesc = "") { var page = new Pages(); var filter = new Filters(); var sorting = new Sorts(); // 1. Da bi mogli search koristiti korisnik mora barem "name" napisati kako bi mogao pretrazivati // 2. Korisnik ne mora puno ime napisati moze cak i pocetno slovo // 3. Dodatno moze koristiti i "last" da pretrazuje po prezimenu osobu // 4. Moze asc ili desc koristiti za age (harkodirano zbog malo atributa u tablici) filter.FirstName = name; filter.LastName = last; page.PageSize = 5; //Age harkodirano zato sto imamo malo atributa u tablici pa cisto radi testiranja je stavjeno Age sorting.OrderBy = "Age"; sorting.AscDesc = ascDesc; var allPeople = await Service.GetAllPeopleAsync(filter, page, sorting); if (allPeople != null) { return(Request.CreateResponse(HttpStatusCode.OK, allPeople)); } return(Request.CreateResponse(HttpStatusCode.NotFound, "Not Found")); }
public HomePageViewModel(MainWindow mainForm) { this.mainForm = mainForm; TmpList = AdList; CurrentSelection = Sorts.First(); SortChangedClick(); }
public void TestBucketSort_ExpectedException() { var expected = sortArray; var actual = Sorts.BucketSort(array, -0); CollectionAssert.AreEqual(expected, actual); }
private void ParseSort(string query) { var rexFilter = new Regex(SortParseRegex); var matches = rexFilter.Matches(query); foreach (Match match in matches) { string field = null; var direction = true; if (!string.IsNullOrEmpty(match.Groups[SortFieldName].Value)) { field = match.Groups[SortFieldName].Value; } if (!string.IsNullOrEmpty(match.Groups[SortDirectionName].Value)) { direction = match.Groups[SortDirectionName].Value == AscOperator; } var filter = new QuerySort { Field = field, Asc = direction }; Sorts.Add(filter); } }
public void TestBucketSort_null() { int[] expected = null; var actual = Sorts.BucketSort(expected, 100); CollectionAssert.AreEqual(expected, actual); }
public void TestBucketSort_norm() { var expected = sortArray; var actual = Sorts.BucketSort(array, 100); CollectionAssert.AreEqual(expected, actual); }
static void Main(string[] args) { int size = 100000; string fileName = "file.txt"; string referenceFile = "referenceFile.txt"; string sortFile = "sortFile.txt"; if (File.Exists(fileName)) { File.Delete(fileName); } if (File.Exists(referenceFile)) { File.Delete(referenceFile); } if (File.Exists(sortFile)) { File.Delete(sortFile); } Generator(fileName, referenceFile, 1000000); Sorts.ExternalSort(fileName, sortFile, size); Console.ReadKey(); }
//builds and starts a sorting thread of the given sorting type. private void sort(Sorts the_sort) { //removes the old sorting thread if present if (my_drawable != null) { resetOldThread(); } //gets the maximum input value from the user int max = getMax(); if (max == -1) { return; } //setup new sorting thread my_drawable = new DrawnSort(the_sort, getInputArray(max), pnlDraw.Width, pnlDraw.Height, max, drawPanel, this); //make sure old memory is reclaimed (otherwise a leak can occur) GC.Collect(); GC.WaitForPendingFinalizers(); //start the sorting thread my_drawable.start(); }
public void MergeSortTestMethod_Null_Array() { //Arange int[] initialArray = null; //Assert Assert.Throws <ArgumentNullException>(() => Sorts.QuickSort(initialArray)); }
public void MergeSortTestMethod_Empty_Array() { //Arange int[] initialArray = new int[] { }; //Assert Assert.Throws <ArgumentException>(() => Sorts.QuickSort(initialArray)); }
/// <summary> /// 解析函数 /// </summary> /// <param name="callExp"></param> /// <param name="funcName"></param> /// <param name="sortType"></param> private void ResolveSelectForFunc(MethodCallExpression callExp, string funcName, SortType sortType) { if (callExp.Arguments[0] is UnaryExpression unary && unary.Operand is LambdaExpression lambda) { var colName = GetColumnName(lambda.Body as MemberExpression, lambda); Sorts.Add(new Sort($"{funcName}({colName})", sortType)); } }
private void SortBtn_Click(object sender, EventArgs e) { Sorts sorts = new Sorts(); sorts.QuicSort(list); list.Reverse(); SetDGV(); }
public PocketRetrieveItem(string ConsumerKey, string AccessToken, States State = States.Unread, Favorites Favorite = Favorites.Both, string Tag = null, ContentTypes ContentType = ContentTypes.All, Sorts Sort = Sorts.NoSort, DetailTypes DetailType = DetailTypes.NoType, string Search = null, string Domain = null, string Since = null, int Count = -1, int Offset = -1) { _consumerKey = ConsumerKey; _accessToken = AccessToken; _state = State; _favorite = Favorite; _tag = Tag; _contentType = ContentType; _sort = Sort; _detailType = DetailType; _search = Search; _domain = Domain; _since = Since; _count = Count; _offset = Offset; }
public ActionResult GetProducts(int page,int pageSize,int? categoryId,int? parentCategoryId,string brandIds,string colorIds,Sorts? sortCondition) { var brandIdValues = new List<int>(); if (!string.IsNullOrEmpty(brandIds)) { brandIdValues = brandIds.Split(',').Select(int.Parse).ToList(); } var colorIdValues = new List<int>(); if (!string.IsNullOrEmpty(colorIds)) { colorIdValues = colorIds.Split(',').Select(int.Parse).ToList(); } var isLastPage = false; var products = _productService.GetProductsByCondition(page, pageSize, out isLastPage, categoryId, parentCategoryId, brandIdValues, colorIdValues, sortCondition); var productsModel = AutoMapper.Mapper.Map<List<ProductViewModel>>(products); var html = this.RenderPartialViewToString("GetProducts", productsModel); return Json(new {isLastPage, html}); }
public List<Product> GetProductsByCondition(int page, int pageSize, out bool isLastPage, int? categoryId,int? parentCategoryId,List<int> brandIds,List<int> colorIds,Sorts? sortCondition ) { Func<Product, bool> whereClause = delegate(Product p) { if (!categoryId.HasValue) { if (!parentCategoryId.HasValue) { return true; } else { return p.ProductCategories.Select(x => x.Category.ParentCategoryId).Contains( parentCategoryId.Value); } } else { return p.ProductCategories.Select(k => k.CategoryId).Contains(categoryId.Value); } }; Func<Product, bool> whereBrandClause = delegate(Product p) { if(brandIds!=null&&brandIds.Count!=0) { if(p.BrandId.HasValue) { return brandIds.Contains(p.BrandId.Value); } else { return false; } } else { return true; } }; Func<Product, bool> whereColorsClause = delegate(Product p) { if(colorIds!=null) { if(colorIds.Count==0) { return true; } else { var productColors = p.ProductColors.Select(x => x.ColorId).Distinct().ToList(); return productColors.Any(colorIds.Contains); } } else { return true; } }; var productsList = Context.Products .Where(whereClause).Where(whereBrandClause).Where(whereColorsClause); if(sortCondition.HasValue) { switch (sortCondition.Value) { case Sorts.New: productsList = productsList.OrderByDescending(x => x.CreatedDate).ThenByDescending(x => x.UpdatedDate); break; case Sorts.Old: productsList = productsList.OrderBy(x => x.CreatedDate).ThenBy(x => x.UpdatedDate); break; case Sorts.BestSell: productsList = productsList.OrderBy(x => { var countInOrder = 0; if(x.OrderDetails!=null) { countInOrder = x.OrderDetails.Sum(k => k.Quantity); } return countInOrder; }); break; case Sorts.DescPrice: productsList = productsList.OrderByDescending(x => x.Price); break; case Sorts.AscPrice: productsList = productsList.OrderBy(x => x.Price); break; case Sorts.Az: productsList = productsList.OrderBy(x => x.ProductName); break; case Sorts.Za: productsList = productsList.OrderByDescending(x => x.ProductName); break; } } else { productsList = productsList.OrderByDescending(x => x.CreatedDate).ThenByDescending(x => x.UpdatedDate); } var products = productsList.Skip((page) * pageSize) .Take(pageSize); isLastPage = !Context.Products .Where(whereClause).Where(whereBrandClause).Where(whereColorsClause).Skip((page + 1) * pageSize).Take(pageSize).Any(); return products.ToList(); }
public Tile(Sorts sort) { this.Sort = sort; }