public CodeUnderflowDbContext GetDbContext() { var dbContextOptions = new DbContextOptionsBuilder <CodeUnderflowDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var dbContext = new CodeUnderflowDbContext(dbContextOptions.Options); return(dbContext); }
public AccountController( UserManager <User> userManager, SignInManager <User> signInManager, IEmailSender emailSender, ILogger <AccountController> logger, CodeUnderflowDbContext dbContext, RoleManager <IdentityRole> roleManager, IUserService userService) { _userManager = userManager; _signInManager = signInManager; _emailSender = emailSender; _logger = logger; db = dbContext; _roleManager = roleManager; _userService = userService; }
private void PopulateDb(CodeUnderflowDbContext db) { db.Tags.Add(new Tag() { Title = "Tag1", Questions = new List <QuestionTag>() { new QuestionTag() { }, new QuestionTag() , new QuestionTag() } }); db.Tags.Add(new Tag() { Title = "Tag2", Questions = new List <QuestionTag>() { new QuestionTag() , new QuestionTag() } }); db.Tags.Add(new Tag() { Title = "Tag3", Questions = new List <QuestionTag>() { new QuestionTag() } }); db.SaveChanges(); }
private void PopulateDb(CodeUnderflowDbContext db) { db.Users.Add(new User() { Id = "user1" }); db.Users.Add(new User() { Id = "user2" }); db.Users.Add(new User() { Id = "user3", IsDeleted = true }); db.Users.Add(new User() { Id = "user4", IsDeleted = true }); db.SaveChanges(); }
private void PopulateDb(CodeUnderflowDbContext db) { db.Answers.Add(new Answer() { Id = 1, Content = "Content1", QuestionId = 11, AuthorId = "asd1", PostDate = DateTime.UtcNow, Votes = 10 }); db.Answers.Add(new Answer() { Id = 2, Content = "Content2", QuestionId = 12, AuthorId = "asd2", PostDate = DateTime.UtcNow, Votes = 12 }); db.Answers.Add(new Answer() { Id = 3, Content = "Content3", QuestionId = 13, AuthorId = "asd3", PostDate = DateTime.UtcNow, Votes = 13 }); db.Answers.Add(new Answer() { Id = 4, Content = "Content4", QuestionId = 14, AuthorId = "asd4", PostDate = DateTime.UtcNow, Votes = 14 }); db.Answers.Add(new Answer() { Id = 5, Content = "Content5", QuestionId = 15, AuthorId = "asd5", PostDate = DateTime.UtcNow, Votes = 15 }); db.Answers.Add(new Answer() { Id = 6, Content = "Content6", QuestionId = 16, AuthorId = "asd6", PostDate = DateTime.UtcNow, Votes = 16 }); db.SaveChanges(); }
public TagService(CodeUnderflowDbContext db) { this.db = db; }
public AnswersService(CodeUnderflowDbContext db) { this.db = db; }
public UserService(CodeUnderflowDbContext db, UserManager <User> userManager, RoleManager <IdentityRole> roleManager) { this.db = db; this.userManager = userManager; this.roleManager = roleManager; }
public SearchService(CodeUnderflowDbContext db) { this.db = db; }
private void PopulateDb(CodeUnderflowDbContext db) { db.Questions.Add(new Question() { Title = "Question1", Votes = new List <Vote>() { new Vote() }, Tags = new List <QuestionTag>() { new QuestionTag() { Tag = new Tag() { Title = "Tag1" } } } }); db.Questions.Add(new Question() { Title = "Question2", Votes = new List <Vote>() { new Vote() }, Tags = new List <QuestionTag>() { new QuestionTag() { Tag = new Tag() { Title = "Tag1" } }, new QuestionTag() { Tag = new Tag() { Title = "Tag2" } } } }); db.Questions.Add(new Question() { Title = "Question3", Votes = new List <Vote>() { new Vote() }, Tags = new List <QuestionTag>() { new QuestionTag() { Tag = new Tag() { Title = "Tag1" } }, new QuestionTag() { Tag = new Tag() { Title = "Tag2" } }, new QuestionTag() { Tag = new Tag() { Title = "Tag3" } } } }); db.SaveChanges(); }
public QuestionsService(CodeUnderflowDbContext db) { this.db = db; }