Пример #1
0
        public async Task <GetAllPersonsModel> GetAllPersonsData()
        {
            GetAllPersonsModel model = new GetAllPersonsModel()
            {
                Persons = new System.Collections.Generic.List <GettAllPersonsModelItem>()
            };
            var personsModels = await this.GetAllPersonsModels();

            foreach (var singlePersonModel in personsModels)
            {
                var personsInModel = await this.GetAllPersonsInPersonModel(singlePersonModel.id);

                foreach (var singlePersonInModel in personsInModel.results)
                {
                    var faceBase64String = await this.GetPersonPictureInBase64(singlePersonModel.id,
                                                                               singlePersonInModel.id, singlePersonInModel.sampleFace.id);

                    model.Persons.Add(new GettAllPersonsModelItem()
                    {
                        PersonName          = singlePersonInModel.name,
                        PersonPictureBase64 = faceBase64String
                    }
                                      );
                }
            }

            return(model);
        }
        public async Task <IActionResult> GetAllPersons()
        {
            GetAllPersonsModel model = null;

            this.MemoryCache.TryGetValue <GetAllPersonsModel>(Constants.ALLPERSONS_INFO, out model);
            if (model == null)
            {
                AzureVideoIndexerHelper helper = new AzureVideoIndexerHelper(this.AzureConfiguration,
                                                                             this.CreateAuthorizedHttpClient());
                model = await helper.GetAllPersonsData();
            }
            return(Ok(model));
        }