예제 #1
0
        public IActionResult Roles(VMRoles collection)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var role       = new IdentityRole(collection.Name);
                    var roleresult = _roleManager.CreateAsync(role);

                    roleresult.Wait();

                    if (roleresult.IsCompletedSuccessfully)
                    {
                        collection.Roles = _roleManager.Roles;
                        collection.Name  = string.Empty;
                        return(View(collection));
                    }
                    return(View(collection));
                }
                return(View(collection));
            }
            catch (Exception ex)
            {
                collection.StatusMessage = ex.Message;
                return(View(collection));
            }
        }
예제 #2
0
        private async Task LoadAsync()
        {
            var   t = Task.Run(() => _roleManager.Roles);
            await t;

            Input = new() {
                Roles = t.Result
            };
        }
예제 #3
0
 public RolesController(IConfiguration _configuration)
 {
     ZADB_    = new ZADB(_configuration.GetConnectionString("ZAExampleDB"));
     vMRoles_ = new VMRoles();
 }