コード例 #1
0
ファイル: AuditTypeService.cs プロジェクト: SD-Team/ME
        public async Task <List <AuditTypeDto> > GetAuditsByAuditType(AuditType1FormDto formdata)
        {
            var data = await _repoAuditType.FindAll().ProjectTo <AuditTypeDto>(_configMapper)
                       .Where(x => x.Audit_Type1.Trim() == formdata.Audit_Type_1.Trim()).OrderByDescending(x => x.Updated_Time).ToListAsync();

            return(data);
        }
コード例 #2
0
ファイル: AuditTypeService.cs プロジェクト: hai123vn/ME
        public async Task <object> GetAuditsByAuditType(AuditType1FormDto formData)
        {
            var data = await _repoAuditType.FindAll().ProjectTo <AuditTypeDto>(_configMapper)
                       .Where(x => x.Audit_Type1.Trim() == formData.Audit_Type_1.Trim()).OrderByDescending(x => x.Updated_Time).ToListAsync();

            var result = (from a in data
                          select new
            {
                audit_type_ID = data.Where(y => y.Audit_Kind == a.Audit_Kind && y.Audit_Type1 == a.Audit_Type1 &&
                                           y.Audit_Type2 == a.Audit_Type2 && y.Brand == a.Brand &&
                                           y.Version == data.Where(x => x.Audit_Kind == a.Audit_Kind && x.Audit_Type1 == a.Audit_Type1 &&
                                                                   x.Audit_Type2 == a.Audit_Type2 && x.Brand == a.Brand).OrderByDescending(x => x.Version).FirstOrDefault().Version)
                                .OrderByDescending(x => x.Audit_Type_ID).FirstOrDefault().Audit_Type_ID,
                Audit_Kind = a.Audit_Kind,
                Audit_Type1 = a.Audit_Type1,
                Audit_Type2 = a.Audit_Type2,
                Version = data.Where(x => x.Audit_Kind == a.Audit_Kind && x.Audit_Type1 == a.Audit_Type1 &&
                                     x.Audit_Type2 == a.Audit_Type2 && x.Brand == a.Brand).OrderByDescending(x => x.Version).FirstOrDefault().Version
            }).ToList().Distinct();

            return(result);
        }
コード例 #3
0
        public async Task <IActionResult> GetAuditsByAuditType(AuditType1FormDto formdata)
        {
            var auditType = await _auditTypeService.GetAuditsByAuditType(formdata);

            return(Ok(auditType));
        }