public async Task <JsonResponse> AddAsync(IFormFile file) { if (file == null) { return(JsonResponse.ArgExceedLimit()); } var fileData = await IOHelper.GetFileDataAsync(file); if (fileData.Length <= 0) { return(JsonResponse.ArgExceedLimit()); } var feat = FaceEncoding(fileData); if (feat == null) { return(JsonResponse.FaceEncodingError()); } var id = Guid.NewGuid().ToString(); var imagePath = await SaveImageFileAsync(ServiceOption.ImageSavePath, id, file.FileName, fileData); return(await AddIndexAsync(feat, id, imagePath)); }
public async Task <JsonResponse> MatchAsync(IFormFile file) { if (file == null) { return(JsonResponse.ArgExceedLimit()); } var fileData = await IOHelper.GetFileDataAsync(file); if (fileData.Length <= 0) { return(JsonResponse.ArgExceedLimit()); } var feat = FaceEncoding(fileData); if (feat == null) { return(JsonResponse.FaceEncodingError()); } return(await MatchAsync(feat)); }