Exemple #1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using var ctx = new OctoCodesContext(serviceProvider.GetRequiredService <DbContextOptions <OctoCodesContext> >());

            if (ctx.Users.Any())
            {
                return;
            }

            ctx.Users.Add(
                new User
            {
                Username = "******",
                Password = AdminController.EncryptPassword("Password1")
            }
                );
            ctx.SaveChanges();
        }
Exemple #2
0
 public ArticleController(OctoCodesContext ctx)
 {
     this.ctx = ctx;
 }
 public AdminController(OctoCodesContext ctx, IWebHostEnvironment webHostEnvironment)
 {
     this.ctx = ctx;
     this.webHostEnvironment = webHostEnvironment;
 }