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(); } }
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); }
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(); }
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; }
public EfRepository(LearningDbContext context) { _context = context; }
public DeptRepo(LearningDbContext learningDbContext) { this.learningDbContext = learningDbContext; }
public LearningDbContext Init() { return(dbContext ?? (dbContext = new LearningDbContext())); }
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; }
public ApplicationUserStore(LearningDbContext context) : base(context) { }
public ImagesService(LearningDbContext db) { _db = db; }
public UserService(LearningDbContext db) { _db = db; }
public ArticleService(LearningDbContext db) { _db = db; }