예제 #1
0
 public Four25Service(IHttpClientFactory httpClient, ScheduleDbContext context, IConfiguration configuration, IOptions <Settings> options)
 {
     _config            = configuration;
     _httpClientFactory = httpClient;
     _settings          = options.Value;
     _context           = context;
 }
예제 #2
0
        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));
            }
        }
예제 #3
0
        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();
        }
예제 #4
0
 public MainWindow(ProductDbContext context, ScheduleDbContext scheduleDbContext)
 {
     this.context           = context;
     this.scheduleDbContext = scheduleDbContext;
     InitializeComponent();
     GetProducts();
     NewProductGrid.DataContext  = NewProduct;
     NewScheduleGrid.DataContext = NewSchedule;
 }
예제 #5
0
        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());
            }
        }
예제 #7
0
        // 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();
            });
        }
예제 #8
0
 public ScheduleInfoRepository(ScheduleDbContext context) : base(context)
 {
 }
예제 #9
0
 public UnitOfWork(ScheduleDbContext dbContext)
 {
     _dbContext = dbContext;
     UserRepository = new UserRepository(dbContext);
     EventRepository = new EventRepository(dbContext);
 }
예제 #10
0
 static TeacherRepo()
 {
     db = new ScheduleDbContext();
 }
예제 #11
0
 public EventRepository(ScheduleDbContext context)
 {
     _context = context;
     _logger.Debug("Event repository created.");
 }
예제 #12
0
 public LecturersController(ScheduleDbContext dbContext)
 {
     this.DbContext = dbContext;
 }
예제 #13
0
 public AllScheduleRepository(ScheduleDbContext db) : base(db)
 {
 }
예제 #14
0
 public DashboardController(ScheduleDbContext dbContext)
 {
     this.DbContext = dbContext;
 }
예제 #15
0
 static SubjectRepo()
 {
     db = new ScheduleDbContext();
 }
예제 #16
0
 public HomeController(ScheduleDbContext dbContext)
 {
     this.DbContext = dbContext;
 }
예제 #17
0
 static RoomRepo()
 {
     db = new ScheduleDbContext();
 }
예제 #18
0
 static GroupRepo()
 {
     db = new ScheduleDbContext();
 }
예제 #19
0
 public UserRepository(ScheduleDbContext context)
 {
     _context = context;
     _logger.Debug("User repository created.");
 }
예제 #20
0
 public Repository(ScheduleDbContext db) : base(db)
 {
     _set = db.Set <TEntity>();
 }