public async Task <FindPersonResponse> FindPerson([FromBody] FindPersonRequest model)
        {
            var client = new KairosClient();

            var clientResponse = await client.Recognise(new RecogniseRequestModel
            {
                Image       = model.Image,
                GalleryName = "MyGallery"
            });

            var subjectId = CheckCandidates(clientResponse);

            var matchedMember = Services.MemberService.GetMembersByPropertyValue("subjectId", subjectId).FirstOrDefault();

            if (matchedMember == null)
            {
                return(new FindPersonResponse {
                    IsSuccess = false
                });
            }
            //var mark = ApplicationContext.Current.Services.MemberService.GetMembersByPropertyValue("subjectId", "Mark").FirstOrDefault();
            //var someMedia = new UmbracoHelper(Umbraco.UmbracoContext).TypedMedia(mark.GetValue("initialImage"));
            var personResponse = new FindPersonResponse
            {
                ImageUrl     = new UmbracoHelper(Umbraco.UmbracoContext).TypedMedia(matchedMember.GetValue("initialImage"))?.Url,
                GreetingText = matchedMember.GetValue <string>("greetingMessage"),
                IsSuccess    = true
            };

            return(personResponse);
        }
コード例 #2
0
        public override Task <Person> GetPerson(FindPersonRequest request, ServerCallContext context)
        {
            var person = GenerateStandardPerson();

            return(Task.FromResult(person));
        }