示例#1
0
        private async Task PersonList(PersonViewModel vm)
        {
            vm.Command = ActionCommand.Cancel;
            vm.Models  = await _mgrFcc.GetListPerson();

            int tcount = vm.Models.Count(); //TODO totalcount

            vm.Paging      = new PagingViewModel(vm.Skip, vm.Take, tcount);
            vm.Models      = vm.Models.Skip(vm.Skip).Take(vm.Take);
            vm.PersonIcons = new Dictionary <string, string>();

            foreach (Person p in vm.Models)
            {
                var file = await _mgrFcc.GetMainPhotoByPersonId(p.Id);

                if (file?.BinaryContent == null)
                {
                    continue;
                }
                string img64    = Convert.ToBase64String(file.BinaryContent);
                string img64Url = string.Format("data:image/" + file.FileType + ";base64,{0}", img64);
                vm.PersonIcons.Add(p.Id, img64Url);
            }
        }