public Four25Service(IHttpClientFactory httpClient, ScheduleDbContext context, IConfiguration configuration, IOptions <Settings> options) { _config = configuration; _httpClientFactory = httpClient; _settings = options.Value; _context = context; }
public ActionResult DoUpload(IFormFile file) { using (var stream = file.OpenReadStream()) { var xs = new XmlSerializer(typeof(Lessons)); var lesssons = (Lessons)xs.Deserialize(stream); using (var db = new ScheduleDbContext()) { var dbs = new DbLessons() { Day = lesssons.Day, Class = lesssons.Class, }; dbs.LessonDay = new Collection <DbLesson>(); foreach (var lesson in lesssons.LessonDay) { dbs.LessonDay.Add(new DbLesson() { Subject = lesson.Subject, Audience = lesson.Audience }); } db.Lessons.Add(dbs); db.SaveChanges(); } return(View(lesssons)); } }
public static void Initialize(ScheduleDbContext context) { //if (env.EnvironmentName == "Development") context.Database.EnsureDeleted(); context.Database.EnsureCreated(); // Look for any data if (context.ScheduleInfos.Any()) { return; // DB has been seeded } var scheduleInfos = new ScheduleInfo[] { new ScheduleInfo { InfoName = "info1", Schema = "SMART901" } }; foreach (ScheduleInfo s in scheduleInfos) { context.ScheduleInfos.Add(s); } context.SaveChanges(); }
public MainWindow(ProductDbContext context, ScheduleDbContext scheduleDbContext) { this.context = context; this.scheduleDbContext = scheduleDbContext; InitializeComponent(); GetProducts(); NewProductGrid.DataContext = NewProduct; NewScheduleGrid.DataContext = NewSchedule; }
public ActionResult List() { List <DbLessons> list; using (var db = new ScheduleDbContext()) { list = db.Lessons.Include(s => s.LessonDay).ToList(); } return(View(list)); }
public void SaveScheduleChanges() { var builder = new DbContextOptionsBuilder <ScheduleDbContext>(); _ = builder.UseInMemoryDatabase(configuration.GetSection("ConnectionStrings:DefaultConnection").Value); var options = builder.Options; using (var context = new ScheduleDbContext(options)) { dbHelper = new DbHelper(context, _logger); JObject json = JObject.Parse(response.Content.ReadAsStringAsync().Result.ToString()); dbHelper.SaveScheduleData(json); Assert.NotNull(context.Schedules.AnyAsync().GetAwaiter().GetResult()); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, ScheduleDbContext context) { context.Database.Migrate(); app.UseCors(x => x .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public ScheduleInfoRepository(ScheduleDbContext context) : base(context) { }
public UnitOfWork(ScheduleDbContext dbContext) { _dbContext = dbContext; UserRepository = new UserRepository(dbContext); EventRepository = new EventRepository(dbContext); }
static TeacherRepo() { db = new ScheduleDbContext(); }
public EventRepository(ScheduleDbContext context) { _context = context; _logger.Debug("Event repository created."); }
public LecturersController(ScheduleDbContext dbContext) { this.DbContext = dbContext; }
public AllScheduleRepository(ScheduleDbContext db) : base(db) { }
public DashboardController(ScheduleDbContext dbContext) { this.DbContext = dbContext; }
static SubjectRepo() { db = new ScheduleDbContext(); }
public HomeController(ScheduleDbContext dbContext) { this.DbContext = dbContext; }
static RoomRepo() { db = new ScheduleDbContext(); }
static GroupRepo() { db = new ScheduleDbContext(); }
public UserRepository(ScheduleDbContext context) { _context = context; _logger.Debug("User repository created."); }
public Repository(ScheduleDbContext db) : base(db) { _set = db.Set <TEntity>(); }