public async Task <JsonResponse> AddIndexAsync(float[] feat, string id = null, string imagePath = "") { var bAdd = await Task.FromResult(AddIndex(feat, out var index)); if (!bAdd) { return(JsonResponse.IndexError()); } if (string.IsNullOrWhiteSpace(id)) { id = Guid.NewGuid().ToString(); } if (imagePath == null) { imagePath = ""; } FaceInfo faceInfo = new FaceInfo { Id = id, Index = index, ImagePath = imagePath, Feature = feat }; bAdd = AddFaceInfo(faceInfo); if (!bAdd) { RemoveIndex(index); } return(new JsonResponse { Code = 0, Msg = "Success", Data = new { Id = id } }); }