Beispiel #1
0
        public async Task <IdentityResult> AddToRoleAsync(int id, string role)
        {
            var user = await GetByIdAsync(id);

            await _roleManager.GetByNameAsync(role);

            return(await _userManager.AddToRoleAsync(user, role));
        }
Beispiel #2
0
        public async virtual Task <IActionResult> GetByNameAsync(string name)
        {
            var result = await CommonOperationAsync <TRole>(async() =>
            {
                return(await _roleManager.GetByNameAsync(name));
            });

            return(Ok(new ApiResponse(LocalizationService, Logger).Ok(Mapper.Map <TRole, TRoleResponse>(result))));
        }