private void SeedData(midTermDbContext dbContext) { var options = new List <Option> { new Option { Id = 1, Text = "Text1", Order = 1, QuestionId = 1 } }; var question = new List <Question> { new Question { Id = 1, Text = "Text1", Description = "Description1" }, new Question { Id = 2, Text = "Text2", Description = "Description2" } }; dbContext.AddRange(options); dbContext.AddRange(question); dbContext.SaveChanges(); }
protected SqliteContext(bool withData = false) { _connection = new SqliteConnection(InMemoryConnectionString); DbContext = new midTermDbContext(CreateOptions()); _connection.Open(); DbContext.Database.EnsureCreated(); if (withData) { SeedData(DbContext); } }
public QuestionService(midTermDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public SurveyUserService(midTermDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public OptionService(Data.midTermDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public AnswerService(midTermDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }