コード例 #1
0
        public async Task <PagedList <AuditType_D_Dto> > SeachMoviequerylist(PaginationParams param, MovieQueryDto movieQueryDto)
        {
            var data = await _repoAuditDType.FindAll().ProjectTo <AuditType_D_Dto>(_configMapper)
                       .Where(x => x.Audit_Type_ID.Trim() == movieQueryDto.Audit_Type_ID.Trim()).ToListAsync();

            if (movieQueryDto.Latest == true)
            {
                if (movieQueryDto.Audititem != "")
                {
                    data = data.Where(x => x.Audit_Item_ID.Trim() == movieQueryDto.Audititem.Trim()).ToList();
                }
                if (movieQueryDto.Text != "")
                {
                    data = data.Where(x => (x.Audit_Item_LL != null && x.Audit_Item_LL.Contains(movieQueryDto.Text)) ||
                                      (x.Audit_Item_EN != null && x.Audit_Item_EN.Contains(movieQueryDto.Text)) ||
                                      (x.Audit_Item_ZW != null && x.Audit_Item_ZW.Contains(movieQueryDto.Text))).ToList();
                }
                var AuditTypeD = data.Select(x => {
                    x.orderby = (x.Audit_Item_ID.Split(".")).Count() == 1?0:x.Audit_Item_ID.Split(".")[1].ToInt();
                    return(x);
                }).ToList();
                AuditTypeD = AuditTypeD.OrderBy(x => x.Audit_Item_ID.Split(".")[0].ToInt()).ThenBy(x => x.orderby).ToList();
                return(PagedList <AuditType_D_Dto> .Create(AuditTypeD, param.PageNumber, param.PageSize));
            }
            List <AuditType_D_Dto> result = new List <AuditType_D_Dto>();

            if (movieQueryDto.Audit_Type_ID != "")
            {
                //lấy Audit_Type_ID sau khi so đk
                var typeM = await _repoAuditMType.FindAll(x => x.Audit_Type_ID == movieQueryDto.Audit_Type_ID).FirstOrDefaultAsync();

                var Audit_Type_ID_model = await _repoAuditMType.FindAll().Where(x => x.Brand == typeM.Brand && x.Audit_Type1
                                                                                == typeM.Audit_Type1 && x.Audit_Type2 == typeM.Audit_Type2 && x.Version == movieQueryDto.Version.ToInt()).
                                          OrderByDescending(x => x.Audit_Type_ID).FirstOrDefaultAsync();

                var Audit_Type_ID = Audit_Type_ID_model.Audit_Type_ID;
                result = await _repoAuditDType.FindAll(x => x.Audit_Type_ID == Audit_Type_ID).ProjectTo <AuditType_D_Dto>(_configMapper).ToListAsync();

                if (movieQueryDto.Audititem != "")
                {
                    result = result.Where(x => x.Audit_Item_ID.Trim() == movieQueryDto.Audititem.Trim()).ToList();
                }
                if (movieQueryDto.Text != "")
                {
                    result = result.Where(x => x.Audit_Item_LL.Contains(movieQueryDto.Text) ||
                                          x.Audit_Item_EN.Contains(movieQueryDto.Text) ||
                                          x.Audit_Item_ZW.Contains(movieQueryDto.Text)).ToList();
                }
                var AuditType = result.Select(x => {
                    x.orderby = (x.Audit_Item_ID.Split(".")).Count() == 1?0:x.Audit_Item_ID.Split(".")[1].ToInt();
                    return(x);
                }).ToList();
                AuditType = AuditType.OrderBy(x => x.Audit_Item_ID.Split(".")[0].ToInt()).ThenBy(x => x.orderby).ToList();
                return(PagedList <AuditType_D_Dto> .Create(AuditType, param.PageNumber, param.PageSize));
            }
            else
            {
                return(PagedList <AuditType_D_Dto> .Create(result, param.PageNumber, param.PageSize));
            }
        }
コード例 #2
0
        public async Task <IActionResult> SeachMoviequerylist([FromQuery] PaginationParams param, MovieQueryDto movieQueryDto)
        {
            var list = await _movieQueryManagementService.SeachMoviequerylist(param, movieQueryDto);

            Response.AddPagination(list.CurrentPage, list.PageSize, list.TotalCount, list.TotalPages);
            return(Ok(list));
        }