Esempio n. 1
0
 private void CreateSlide(LearningDbContext context)
 {
     if (context.Slides.Count() == 0)
     {
         List<Slide> listSlide = new List<Slide>()
         {
             new Slide() {
                 Name ="Slide 1",
                 DisplayOrder =1,
                 Status =true,
                 Url ="#",
                 Image ="Assets/client/img/banner/banner1.jpg",
                },
             new Slide() {
                 Name ="Slide 2",
                 DisplayOrder =2,
                 Status =true,
                 Url ="#",
                 Image ="Assets/client/img/banner/banner1.jpg",
             },
         };
         context.Slides.AddRange(listSlide);
         context.SaveChanges();
     }
 }
Esempio n. 2
0
        private static IdentityRole AddRoles(LearningDbContext dbContext, RoleManager <IdentityRole> roleManager)
        {
            var roleUser = new IdentityRole()
            {
                Id             = Guid.NewGuid().ToString(),
                Name           = "User",
                NormalizedName = "User"
            };


            dbContext.Roles.Add(roleUser);

            return(roleUser);
        }
Esempio n. 3
0
        private static void SeedUser(LearningDbContext dbContext, UserManager <IdentityUser> userManager, RoleManager <IdentityRole> roleManager)
        {
            if (dbContext.Roles.Any())
            {
                return;
            }

            var role = AddRoles(dbContext, roleManager);

            dbContext.SaveChangesAsync().Wait();

            AddUsers(dbContext, userManager, role);
            dbContext.SaveChangesAsync().Wait();
        }
Esempio n. 4
0
        private static void AddUsers(LearningDbContext dbContext, UserManager <IdentityUser> userManager, IdentityRole role)
        {
            var user = new IdentityUser
            {
                Id                   = Guid.NewGuid().ToString(),
                Email                = "*****@*****.**",
                UserName             = "******",
                PhoneNumber          = "0976354547",
                PhoneNumberConfirmed = true,
                EmailConfirmed       = true,
                SecurityStamp        = Guid.NewGuid().ToString("D")
            };

            userManager.CreateAsync(user, "Aa123456@").Wait();
            userManager.AddToRoleAsync(user, "User").Wait();
        }
 public DeptController(LearningDbContext learningDbContext)
 {
     this.learningDbContext = learningDbContext;
 }
Esempio n. 6
0
 public EfRepository(LearningDbContext context)
 {
     _context = context;
 }
Esempio n. 7
0
 public DeptRepo(LearningDbContext learningDbContext)
 {
     this.learningDbContext = learningDbContext;
 }
Esempio n. 8
0
 public LearningDbContext Init()
 {
     return(dbContext ?? (dbContext = new LearningDbContext()));
 }
Esempio n. 9
0
 public BooksController(LearningDbContext context, ILoggerManager logger, IBookService bookService)
 {
     _context     = context;
     _logger      = logger;
     _bookService = bookService;
 }
 public WordService(LearningDbContext db)
 {
     _db = db;
 }
Esempio n. 11
0
 public DeptController(LearningDbContext context, ILogger <DeptController> logger)
 {
     this.context = context;
     this.logger  = logger;
 }
 public ListOfAllDataReposity(LearningDbContext context)
 {
     _context = context;
 }
Esempio n. 13
0
 public ApplicationUserStore(LearningDbContext context)
     : base(context)
 {
 }
 public ImagesService(LearningDbContext db)
 {
     _db = db;
 }
Esempio n. 15
0
 public UserService(LearningDbContext db)
 {
     _db = db;
 }
Esempio n. 16
0
 public ArticleService(LearningDbContext db)
 {
     _db = db;
 }