public static List <audit_log> Admin_AuditLogShow() { AuditLoggerTable altobj = new AuditLoggerTable(); return(altobj.List()); }
public string Validate(string url, byte[] imagebytes, bool face, bool multiple_face, bool sunglasses, bool emotions) { try { //API CAll var apiresponse = FaceAPICall(imagebytes); //DB check AuditLoggerTable alt = new AuditLoggerTable(); bool isface = true, ismultipleface = true, issunglasses = true, isemotions = true; if (apiresponse.Length == 2) { isface = false; } if (apiresponse.Length > 2) { JArray items = JArray.Parse(apiresponse); for (int i = 0; i < items.Count; i++) { var item = (JObject)items[i]; var itemres = item["faceAttributes"]["glasses"]; if (itemres.ToString() == "Sunglasses") { issunglasses = false; } } } if (apiresponse.Length > 2) { JArray items = JArray.Parse(apiresponse); int length = items.Count; if (length > 1) { ismultipleface = false; } } if (apiresponse.Length > 2) { JArray items = JArray.Parse(apiresponse); for (int i = 0; i < items.Count; i++) { var item = (JObject)items[i]; var anger = item["faceAttributes"]["emotion"]["anger"]; var sadness = item["faceAttributes"]["emotion"]["sadness"]; var surprise = item["faceAttributes"]["emotion"]["surprise"]; if ((float)anger > 0.1 || (float)sadness > 0.1 || (float)surprise > 0.1) { isemotions = false; } } } if (face) { //Check with API Call Result if (isface) { alt.Add("Face Availability", "Pass", url); } else { alt.Add("Face Availability", "Fail", url); return("Face Not Found"); } } //DB check if (multiple_face) { //Check with API Call Result if (ismultipleface) { alt.Add("Multiple Face", "Pass", url); } else { alt.Add("Multiple Face", "Fail", url); return("Multiple Faces are not allowed"); } } //DB check if (sunglasses) { //Check with API Call Result if (issunglasses) { alt.Add("Sunglasses", "Pass", url); } else { alt.Add("Sunglasses", "Fail", url); return("Please remove the sunglasses"); } } //DB check if (emotions) { //Check with API Call Result if (isemotions) { alt.Add("Emotions", "Pass", url); } else { alt.Add("Emotions", "Fail", url); return("Your expression must be Neutral"); } } //Success Enum return("0"); } catch (Exception e) { error = e.Message; return(""); } }