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;
 }
Пример #2
0
        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);
        }
Пример #3
0
 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();
     }
 }
Пример #4
0
        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();
        }
Пример #5
0
 public RoomRepository(DormitoryContext context) : base(context)
 {
 }
Пример #6
0
 public PriorityRepository(DormitoryContext context) : base(context)
 {
 }
Пример #7
0
 protected Repository(DormitoryContext context)
 {
     this.context = context;
     DbSet        = this.context.Set <TEntity>();
 }
Пример #8
0
 public StudentRepository(DormitoryContext context) : base(context)
 {
 }
 public TemporaryAbsenceRepository(DormitoryContext context) : base(context)
 {
 }
Пример #10
0
 public BuildingRepository(DormitoryContext context) : base(context)
 {
 }
Пример #11
0
 public FacultyRepository(DormitoryContext context) : base(context)
 {
 }
Пример #12
0
 public ViolationRecordRepository(DormitoryContext context) : base(context)
 {
 }
Пример #13
0
 public LateArrivalRepository(DormitoryContext context) : base(context)
 {
 }
Пример #14
0
 public Rp(DormitoryContext context) : base(context)
 {
 }
Пример #15
0
 public Repository(DormitoryContext context)
 {
     this.context = context;
 }
Пример #16
0
 public FloorRepository(DormitoryContext context) : base(context)
 {
 }
Пример #17
0
 public ClassRepository(DormitoryContext context) : base(context)
 {
 }
Пример #18
0
 public EmployeeRepository(DormitoryContext context) : base(context)
 {
 }