File tree 2 files changed +7
-1
lines changed
Webgentle.BookStore/Webgentle.BookStore
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 1
- using Microsoft . AspNetCore . Mvc ;
1
+ using Microsoft . AspNetCore . Authorization ;
2
+ using Microsoft . AspNetCore . Mvc ;
2
3
using Microsoft . Extensions . Configuration ;
3
4
using Microsoft . Extensions . Options ;
4
5
using System ;
@@ -69,6 +70,8 @@ public ViewResult AboutUs()
69
70
return View ( ) ;
70
71
}
71
72
73
+ // Uncomment the below line to enable roles on this action method.
74
+ //[Authorize(Roles ="Admin,User")]
72
75
public ViewResult ContactUs ( )
73
76
{
74
77
return View ( ) ;
Original file line number Diff line number Diff line change @@ -13,18 +13,21 @@ public class AccountRepository : IAccountRepository
13
13
{
14
14
private readonly UserManager < ApplicationUser > _userManager ;
15
15
private readonly SignInManager < ApplicationUser > _signInManager ;
16
+ private readonly RoleManager < IdentityRole > _roleManager ;
16
17
private readonly IUserService _userService ;
17
18
private readonly IEmailService _emailService ;
18
19
private readonly IConfiguration _configuration ;
19
20
20
21
public AccountRepository ( UserManager < ApplicationUser > userManager ,
21
22
SignInManager < ApplicationUser > signInManager ,
23
+ RoleManager < IdentityRole > roleManager ,
22
24
IUserService userService ,
23
25
IEmailService emailService ,
24
26
IConfiguration configuration )
25
27
{
26
28
_userManager = userManager ;
27
29
_signInManager = signInManager ;
30
+ _roleManager = roleManager ;
28
31
_userService = userService ;
29
32
_emailService = emailService ;
30
33
_configuration = configuration ;
You can’t perform that action at this time.
0 commit comments