public async Task <List <CandidateCustomer> > IdentifyCustomerCandidateAsync(int id, byte[] image)
        {
            // ToDo: Call SearchCandidatesAsync method from groupManager property and save the return value into candidates variable
            List <Candidate> candidates = null;
            var customersCandidates     = new List <CandidateCustomer>();

            foreach (var candidate in candidates)
            {
                var customerCandidate = CandidateCustomer.NewFromCandidate(candidate);

                if (candidate.Id > 0)
                {
                    var faces = faceManager.GetAllByPersonId(candidate.Id);
                    customerCandidate.PhotoId = faces.Any() ? faces[0].Id : default(int);
                    // ToDo: Call GetAllPurchasesByPersonId method from customerRepository property and save the return value. Use candidate.Id as personId parameter and don't forget to call .ToList() before assign the results.
                    customerCandidate.Purchases = null;
                    // ToDo: Call GetAllVisualizationsByPersonId method from customerRepository property and save the return value. Use candidate.Id as personId parameter and don't forget to call .ToList() before assign the results.
                    customerCandidate.Visualizations = null;
                }

                customersCandidates.Add(customerCandidate);
            }

            return(customersCandidates);
        }
Esempio n. 2
0
        public ActionResult Index(int?personId = null, int?groupId = null)
        {
            var faceListViewModel = new FaceListViewModel()
            {
                List = personId.HasValue ?
                       faceManager.GetAllByPersonId(personId.Value).Select(face => new FaceViewModel(face)) :
                       groupId.HasValue ?
                       faceManager.GetAllByGroupId(groupId.Value).Select(face => new FaceViewModel(face)) :
                       faceManager.GetAll().Select(face => new FaceViewModel(face))
            };

            return(View(faceListViewModel));
        }