public ActionResult GetBiometricData(string enrollmentId) { var bioModel = new BiometricDbModel { FingerReasons = new List <FingerReason>() }; try { var photographs = _photographService.Query(x => x.EnrollmentId == enrollmentId).Select().ToList(); var fingerprintImages = _fingerprintImageService.Query(x => x.EnrollmentId == enrollmentId).Select().ToList(); var signatures = _signatureService.Query(x => x.EnrollmentId == enrollmentId).Select().ToList(); if (photographs.Any()) { bioModel.Photo = $"data:image/jpg;base64,{Convert.ToBase64String(photographs[0].PhotographImage)}"; } if (signatures.Any()) { bioModel.Signature = $"data:image/jpg;base64,{Convert.ToBase64String(signatures[0].SignatureImage)}"; } else { bioModel.Signature = ""; } //bioModel.LeftLittle = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFLittle) ? $"data:image/jpg;base64,{Convert.ToBase64String(fingerprintImages.Find(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFLittle).FingerPrintImage)}" : ""; //bioModel.LeftRing = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFRing) ? $"data:image/jpg;base64,{Convert.ToBase64String(fingerprintImages.Find(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFRing).FingerPrintImage)}" : ""; //bioModel.LeftMiddle = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFMiddle) ? $"data:image/jpg;base64,{Convert.ToBase64String(fingerprintImages.Find(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFMiddle).FingerPrintImage)}" : ""; //bioModel.LeftIndex = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFIndex) ? $"data:image/jpg;base64,{Convert.ToBase64String(fingerprintImages.Find(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFIndex).FingerPrintImage)}" : ""; //bioModel.LeftThumb = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFThumb) ? $"data:image/jpg;base64,{Convert.ToBase64String(fingerprintImages.Find(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFThumb).FingerPrintImage)}" : ""; //bioModel.RightThumb = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFThumb) ? $"data:image/jpg;base64,{Convert.ToBase64String(fingerprintImages.Find(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFThumb).FingerPrintImage)}" : ""; //bioModel.RightIndex = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFIndex) ? $"data:image/jpg;base64,{Convert.ToBase64String(fingerprintImages.Find(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFIndex).FingerPrintImage)}" : ""; //bioModel.RightMiddle = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFMiddle) ? $"data:image/jpg;base64,{Convert.ToBase64String(fingerprintImages.Find(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFMiddle).FingerPrintImage)}" : ""; //bioModel.RightRing = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFRing) ? $"data:image/jpg;base64,{Convert.ToBase64String(fingerprintImages.Find(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFRing).FingerPrintImage)}" : ""; //bioModel.RightLittle = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFLittle) ? $"data:image/jpg;base64,{Convert.ToBase64String(fingerprintImages.Find(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFLittle).FingerPrintImage)}" : ""; bioModel.LeftLittle = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFLittle) ? "/Images/LFLittle.jpg" : ""; bioModel.LeftRing = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFRing) ? "/Images/LFRing.jpg" : ""; bioModel.LeftMiddle = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFMiddle) ? "/Images/LFMiddle.jpg" : ""; bioModel.LeftIndex = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFIndex) ? "/Images/LFIndex.jpg" : ""; bioModel.LeftThumb = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.LFThumb) ? "/Images/LFThumb.jpg" : ""; bioModel.RightThumb = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFThumb) ? "/Images/RFThumb.jpg" : ""; bioModel.RightIndex = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFIndex) ? "/Images/RFIndex.jpg" : ""; bioModel.RightMiddle = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFMiddle) ? "/Images/RFMiddle.jpg" : ""; bioModel.RightRing = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFRing) ? "/Images/RFRing.jpg" : ""; bioModel.RightLittle = fingerprintImages.Any(f => f.FingerIndexId == (int)EnumManager.FingerDescription.RFLittle) ? "/Images/RFLittle.jpg" : ""; var fingerprintReasons = _fingerprintReasonService.Query(f => f.EnrollmentId == enrollmentId).Select().ToList(); if (fingerprintReasons.Any()) { fingerprintReasons.ForEach(t => { var finger = Enum.GetName(typeof(EnumManager.FingerDescription), t.FingerIndex); bioModel.FingerReasons.Add(new FingerReason { FingerIndex = t.FingerIndex, Name = finger, Reason = t.FingerReason }); }); } return(Json(bioModel, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(Json(bioModel, JsonRequestBehavior.AllowGet)); } }