예제 #1
0
        public async Task <IActionResult> OnPostListAsync(string selectedTenant)
        {
            var adminToken = IzendaTokenAuthorization.GetIzendaAdminToken();

            var izendaTenant = await IzendaUtilities.GetIzendaTenantByName(selectedTenant, adminToken);

            var roleDetailsByTenant = await IzendaUtilities.GetAllIzendaRoleByTenant(izendaTenant?.Id ?? null, adminToken);

            var roles = roleDetailsByTenant.Select(r => new { r.Id, r.Name }).ToList();

            RoleSelectList = new SelectList(roles, "Id", "Name");

            return(new JsonResult(RoleSelectList));
        }
예제 #2
0
        public async Task <JsonResult> GetRoleListByTenant(string selectedTenant)
        {
            var selectList = new List <string>();
            var adminToken = IzendaTokenAuthorization.GetIzendaAdminToken();

            var izendaTenant = await IzendaUtilities.GetIzendaTenantByName(selectedTenant, adminToken);

            var roleDetailsByTenant = await IzendaUtilities.GetAllIzendaRoleByTenant(izendaTenant?.Id ?? null, adminToken);

            roleDetailsByTenant.ForEach(r => selectList.Add(r.Name));

            var itemList = selectList.Select(i => new SelectListItem {
                Text = i
            }).ToList();

            return(Json(new SelectList(itemList, "Value", "Text")));
        }
        private async Task PopulateRoleList()
        {
            RoleList.Items.Clear();

            var selectList     = new List <string>();
            var selectedTenant = TenantList.SelectedValue;
            var adminToken     = IzendaTokenAuthorization.GetIzendaAdminToken();
            var izendaTenant   = await IzendaUtilities.GetIzendaTenantByName(selectedTenant, adminToken);

            var roleDetailsByTenant = await IzendaUtilities.GetAllIzendaRoleByTenant(izendaTenant?.Id ?? null, adminToken);

            roleDetailsByTenant.ForEach(r => selectList.Add(r.Name));

            RoleList.DataSource = selectList;
            RoleList.DataBind();
            RoleList.SelectedValue = selectList.FirstOrDefault();
        }