Exemple #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();
     }
 }
Exemple #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);
        }
Exemple #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();
        }
Exemple #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;
 }
Exemple #6
0
 public EfRepository(LearningDbContext context)
 {
     _context = context;
 }
Exemple #7
0
 public DeptRepo(LearningDbContext learningDbContext)
 {
     this.learningDbContext = learningDbContext;
 }
Exemple #8
0
 public LearningDbContext Init()
 {
     return(dbContext ?? (dbContext = new LearningDbContext()));
 }
Exemple #9
0
 public BooksController(LearningDbContext context, ILoggerManager logger, IBookService bookService)
 {
     _context     = context;
     _logger      = logger;
     _bookService = bookService;
 }
 public WordService(LearningDbContext db)
 {
     _db = db;
 }
 public DeptController(LearningDbContext context, ILogger <DeptController> logger)
 {
     this.context = context;
     this.logger  = logger;
 }
 public ListOfAllDataReposity(LearningDbContext context)
 {
     _context = context;
 }
Exemple #13
0
 public ApplicationUserStore(LearningDbContext context)
     : base(context)
 {
 }
 public ImagesService(LearningDbContext db)
 {
     _db = db;
 }
Exemple #15
0
 public UserService(LearningDbContext db)
 {
     _db = db;
 }
Exemple #16
0
 public ArticleService(LearningDbContext db)
 {
     _db = db;
 }