public RestClientService(DormitoryContext context, HttpClient client, IRepository <Sensor> sensorRepo) { this.context = context; _client = client ?? throw new ArgumentNullException(nameof(client)); _client.BaseAddress = new Uri("http://telerikacademy.icb.bg/api/sensor"); this._client.DefaultRequestHeaders.Add("auth-token", "8e4c46fe-5e1d-4382-b7fc-19541f7bf3b0"); this.sensorRepo = sensorRepo; }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); //GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var dc = DormitoryContext.Create(); Database.SetInitializer(new DictInitializer()); dc.Database.Initialize(true); }
public static void ClearAllData() { using (var context = new DormitoryContext()) { Exec(context.Rooms); Exec(context.Floors); Exec(context.Buildings); Exec(context.Priorities); Exec(context.Students); Exec(context.Classes); Exec(context.Faculties); Exec(context.Clubs); Exec(context.Employees); context.SaveChanges(); } }
public ApplicationModel(ApplicationJsonModel jsonData) { DormitoryContext db = new DormitoryContext(); Id = Guid.NewGuid(); var dateArray = jsonData.DateOfBirth.Split('-').Select(x => Convert.ToInt32(x)).ToArray(); DateOfBirth = new DateTime(dateArray[0], dateArray[1], dateArray[2]); FirstName = jsonData.FirstName; Surname = jsonData.Surname; AcademicYearOfStudies = Convert.ToUInt32(jsonData.AcademicYearOfStudies); CitizenshipDictModelId = db.CitizenshipDict.First(x => x.Code == jsonData.CitizenshipDictCode).Id; CourseDictModelId = db.CourseDict.First(x => x.Code == jsonData.CourseDictKey).Id; GenderDictModelId = db.GenderDict.First(x => x.Code == jsonData.GenderDictKey).Id; EmailAdress = jsonData.EmailAdress; CollegeId = jsonData.CollegeId; IndexNumber = jsonData.IndexNumber; CourseYearDictModelId = db.CourseYearDict.First(x => x.Code == jsonData.CourseYearDictKey).Id; NumberOfBedDictModelId = db.NumberOfBedDict.First(x => x.Code == jsonData.NumberOfBedDictKey).Id; db.Application.Add(this); db.SaveChanges(); db.Dispose(); }
public RoomRepository(DormitoryContext context) : base(context) { }
public PriorityRepository(DormitoryContext context) : base(context) { }
protected Repository(DormitoryContext context) { this.context = context; DbSet = this.context.Set <TEntity>(); }
public StudentRepository(DormitoryContext context) : base(context) { }
public TemporaryAbsenceRepository(DormitoryContext context) : base(context) { }
public BuildingRepository(DormitoryContext context) : base(context) { }
public FacultyRepository(DormitoryContext context) : base(context) { }
public ViolationRecordRepository(DormitoryContext context) : base(context) { }
public LateArrivalRepository(DormitoryContext context) : base(context) { }
public Rp(DormitoryContext context) : base(context) { }
public Repository(DormitoryContext context) { this.context = context; }
public FloorRepository(DormitoryContext context) : base(context) { }
public ClassRepository(DormitoryContext context) : base(context) { }
public EmployeeRepository(DormitoryContext context) : base(context) { }