Example #1
0
        public Poll RegisterPoll(string name)
        {
            var accountId = _accountsService.Create(DataLayer.Enums.AccountType.IdentityProvider, name, "qqq", true);
            var account   = _accountsService.GetById(accountId);
            var issuer    = account.PublicSpendKey.ToHexString();

            var attributeDefitions = new List <AttributeDefinition> {
                new AttributeDefinition
                {
                    IsRoot        = true,
                    AttributeName = "VoterNumber",
                    SchemeName    = AttributesSchemes.ATTR_SCHEME_NAME_IDCARD,
                    Alias         = "Voter Number"
                }
            };

            attributeDefitions.ForEach(a =>
            {
                var schemeId = _dataAccessService.AddAttributeToScheme(issuer, a.AttributeName, a.SchemeName, a.Alias, a.Description);
                if (a.IsRoot)
                {
                    _dataAccessService.ToggleOnRootAttributeScheme(schemeId);
                }
            });


            var id = _dataAccessService.AddPoll(name, accountId);

            return(FetchPoll(id));
        }