Ejemplo n.º 1
0
        public EnrollResponse Enroll(string subjectId, string imageBase64)
        {
            var enrollResponse = _kairosClient.Enroll(imageBase64, subjectId, Configurations.Config.KairosGalleryName, "FRONTAL");

            return(enrollResponse);
        }
        private void MemberService_Saved(IMemberService sender, SaveEventArgs <IMember> e)
        {
            foreach (IMember member in e.SavedEntities)
            {
                var subjectId = member.GetValue <string>("subjectId");
                if (subjectId == null)
                {
                    return;
                }

                var kairosClient = new KairosClient();
                if (!kairosClient.CheckPerson(subjectId))
                {
                    //todo: instead of using e.SavedEntities, use sender to get the member and then get its values instead!
                    var initialMemberImage = new UmbracoHelper(UmbracoContext.Current).TypedMedia(member.GetValue("initialImage"));
                    var imageUrl           = initialMemberImage.Url;

                    var enrollResult = System.Threading.Tasks.Task.Run(async() => await kairosClient.Enroll(new EnrollRequestModel
                    {
                        SubjectId   = subjectId,
                        GalleryName = "MyGallery",
                        Image       = $"{ConfigurationManager.AppSettings["PublicUrl"]}{imageUrl}"
                    })
                                                                       ).Result;
                }
            }
        }