Пример #1
0
        public static async Task InitializeAsync(GustoDbContext context, IServiceProvider serviceProvider)
        {
            var RoleManager = serviceProvider.GetRequiredService <RoleManager <IdentityRole> >();

            string[]       roleNames = { "Admin", "Chef", "User" };
            IdentityResult roleResult;

            foreach (var roleName in roleNames)
            {
                var roleExist = await RoleManager.RoleExistsAsync(roleName);

                if (!roleExist)
                {
                    roleResult = await RoleManager.CreateAsync(new IdentityRole(roleName));
                }
            }

            //var UserManager = serviceProvider.GetRequiredService <UserManager<User>>();
            //var SignInManager = serviceProvider.GetRequiredService<SignInManager<User>>();
            //if (!await UserManager.GetUserName([email protected])) { }
            //    var user = new User()
            //{
            //    UserName = "******",
            //    Email = "*****@*****.**",
            //    LastName = "jeff",
            //    FirstMidName = "test"
            //};
            //await UserManager.AddToRoleAsync(user, "User");
            //await SignInManager.SignInAsync(user, isPersistent: false);
        }
Пример #2
0
 public BaseController(GustoDbContext context)
 {
     _context = context;
 }
Пример #3
0
 public RecettesController(GustoDbContext context) : base(context)
 {
 }
Пример #4
0
 public EtapesController(GustoDbContext context) : base(context)
 {
 }
Пример #5
0
 public CategoriesController(GustoDbContext context) : base(context)
 {
 }
Пример #6
0
 public AvisController(GustoDbContext context) : base(context)
 {
 }
Пример #7
0
 public DashboardController(GustoDbContext context) : base(context)
 {
 }
Пример #8
0
 public NotesController(GustoDbContext context) : base(context)
 {
 }
Пример #9
0
 public ComposersController(GustoDbContext context) : base(context)
 {
 }
Пример #10
0
 public FavorisController(GustoDbContext context) : base(context)
 {
 }
Пример #11
0
 public RecettesController(GustoDbContext context)
 {
     _context = context;
 }
Пример #12
0
 public IngredientsController(GustoDbContext context) : base(context)
 {
 }
Пример #13
0
 public HomeController(GustoDbContext context) : base(context)
 {
 }