コード例 #1
0
        public async Task <IActionResult> GiveAccessToGroup(int toUserId, string group)
        {
            var user = await GetCurrentLocalUserAsync();

            if (Debugger.IsAttached || await _userManager.IsInRoleAsync(user, "admin"))
            {
                if (await _roleManager.RoleExistsAsync(group))
                {
                    var code = await _invitationService.NewGroupAccessCode(user.Id, toUserId, group);

                    return(Content($"You have given {toUserId} access to {group}. The link is\n<a href=\"/AcceptInvite/{code.Code}\">{code.Code}</a>"));
                }
            }

            return(Redirect("/Error/404"));
        }