コード例 #1
0
        public async Task <IActionResult> AddToRole(int id)
        {
            User user = userData.Get(id);

            if (await userManager.IsInRoleAsync(user, Globals.Admin))
            {
                return(RedirectToAction(nameof(AdminHomePage)));
            }
            userData.AddToRole(id, Globals.Admin);
            return(RedirectToAction(nameof(Index), "Home"));
        }