public Response Create(string personGroupId, PersonDto dto) { try { if (dto == null) { throw new ArgumentNullException("dto", "The object that you provided cannot be null."); } if (string.IsNullOrWhiteSpace(personGroupId)) { throw new ArgumentNullException("personGroupId", "The person group ID that you entered is invalid"); } var validationResults = new PersonValidator().Validate(dto); if (validationResults.IsValid) { var result = _personAPI.Create(personGroupId, dto.Name) .Result; return(_responseHelper.CreateResponse <PersonDto>( result, $"'{ dto.Name }' has been successfully created in the '{ personGroupId }' person-group.")); } else { throw new InvalidOperationException("The person name that you have provided is invalid."); } } catch (AggregateException aex) { throw new Exception($"Error Message: { aex.Message }"); } }
public Response Create(PersonGroupDto dto) { if (dto == null) { throw new ArgumentNullException("dto", "The object that you provided cannot be null."); } var validationResults = new PersonGroupValidator().Validate(dto); if (validationResults.IsValid) { var result = _personGroupAPI.Create(dto.PersonGroupId) .Result; return(_responseHelper.CreateResponse <bool>( result, $"Person-group '{ dto.PersonGroupId }' has been successfully created.")); } else { throw new InvalidOperationException("The person group ID that you have provided is invalid."); } }
public Response DetectFace(string imagePath) { try { if (string.IsNullOrWhiteSpace(imagePath)) { throw new ArgumentNullException("imagePath", "The image path that you entered is invalid"); } var result = _faceAPI.Detect(imagePath) .Result; return(_responseHelper.CreateResponse <DetectedFaceDto[]>( result, "The face data of the image you uploaded has successfully been detected.")); } catch (AggregateException aex) { throw new Exception($"Error Message: { aex.Message }"); } }