コード例 #1
0
ファイル: SortExtension.cs プロジェクト: grroma/mems
 public static IQueryable <Subdivision> SortSubdivisions(this IQueryable <Subdivision> querySubdivision,
                                                         SortPage condition)
 {
     return(condition switch
     {
         SortPage.NameIncrease => querySubdivision.OrderBy(t => t.Name),
         SortPage.NameDecrease => querySubdivision.OrderByDescending(t => t.Name),
         SortPage.TypeIncrease => querySubdivision.OrderBy(t => t.Type),
         SortPage.TypeDecrease => querySubdivision.OrderByDescending(t => t.Type),
         SortPage.AreaIncrease => querySubdivision.OrderBy(t => t.Area),
         SortPage.AreaDecrease => querySubdivision.OrderByDescending(t => t.Area),
         SortPage.CapacityIncrease => querySubdivision.OrderBy(t => t.Capacity),
         SortPage.CapacityDecrease => querySubdivision.OrderByDescending(t => t.Capacity),
         _ => querySubdivision
     });
コード例 #2
0
ファイル: SubdivisionController.cs プロジェクト: grroma/mems
        public async Task <Page <Subdivision> > GetPage(
            [FromQuery] string keyword,
            [FromQuery] int?filterSubdivisionType,
            [FromQuery] int?filterSubdivisionArea,
            [FromQuery] SortPage sortPage = SortPage.NameIncrease,
            [FromQuery] int pageSize      = PaginatorConstants.DefaultPageSize,
            [FromQuery] int page          = PaginatorConstants.DefaultPageNumber)
        {
            var param = new SubdivisionPageDto
            {
                Keyword = keyword,
                FilterSubdivisionType = filterSubdivisionType,
                FilterSubdivisionArea = filterSubdivisionArea,
                SortPage = sortPage,
                PageSize = pageSize,
                Page     = page
            };

            return(await _subdivisionRepository.GetPage(param));
        }