//        public CheeseWiseDbContext()
        //        {
        //            AddSampleData();
        //        }

//        protected override void OnModelCreating(ModelBuilder modelBuilder)
//        {
//            modelBuilder.Entity<Company>()
//                .HasMany(c => c.Services)
//                .WithOne(c=>c.)
//                .OnDelete(DeleteBehavior.SetNull + -*);
//        }

        private void AddSampleData()
        {
            Users.AddRange(SampleData.Users);
            Accounts.AddRange(SampleData.Accounts);
            Categories.AddRange(SampleData.Categories);
            Companies.AddRange(SampleData.Companies);
        }
예제 #2
0
 public void AddResponseData(LaGouResponseData data)
 {
     if (data == null)
     {
         return;
     }
     Companies.AddRange(data.Companies.Select(p => new KeyValuePair <int, LaGouCompanyEntity>(p.CompanyId, p)));
     Positions.AddRange(data.Positions.Select(p => new KeyValuePair <long, LaGouPositionEntity>(p.PositionId, p)));
     HrInfos.AddRange(data.HrInfos.Select(p => new KeyValuePair <long, LaGouHrInfoEntity>(p.UserId, p)));
     HrDailyRecords.AddRange(data.HrDailyRecords.Select(p => new KeyValuePair <long, LaGouHrDailyRecordEntity>(p.UserId, p)));
 }
예제 #3
0
        //protected override void OnModelCreating(ModelBuilder modelBuilder)
        //{
        //    modelBuilder.Entity<Specialization>().HasData(
        //        new Specialization[]
        //        {
        //            new Specialization {Id = 1, NameSpecialization="IT" },
        //            new Specialization {Id = 2, NameSpecialization="Bank" },
        //        });
        //    modelBuilder.Entity<Company>().HasData(
        //        new Company[]
        //        {
        //            new Company { Id=1, NameCamp="Giga", Specialization = "IT"},
        //            new Company { Id=2, NameCamp="MKB"},
        //        });
        //    modelBuilder.Entity<Employee>().HasData(
        //        new Employee[]
        //        {
        //            new Employee { Id=1, Name="Ivan", Surname="Ivanov", Otchestvo="Ivanovich", Birthday = new DateTime(2008, 5, 15)},
        //            new Employee { Id=2, Name="Sergey", Surname="Sergeev", Otchestvo="Sergeevich", Birthday = new DateTime(2001, 2, 20)}
        //        });
        //    algorithms.Students.AddRange(new List<Student>() { tom, bob });
        //    Specializations.Where(u => u.Id = 1)
        //}
        //using (ApiContext db = new ApiContext())
        //{
        //}
        void test()
        {
            Specialization it = new Specialization {
                Id = 1, NameSpecialization = "IT"
            };
            Specialization bank = new Specialization {
                Id = 2, NameSpecialization = "Bank"
            };

            Specializations.AddRange(it, bank);

            Company giga = new Company {
                Id = 1, NameCamp = "Giga"
            };
            Company mkb = new Company {
                Id = 2, NameCamp = "MKB"
            };

            Companies.AddRange(giga, mkb);

            giga.Specialization.Add(it);
            mkb.Specialization.Add(bank);
        }
예제 #4
0
        public MainViewModel()
        {
            SelectedProfile = new ProfileModel();
            //pulls models from external source but no logic which collections are for
            try
            {
                profileCommand = new ProfileCommand(_connectionString);
                //list that comes from the database will be added to Emplyees Bindable collection
                Profiles.AddRange(profileCommand.GetList());

                EmployeeCommand employeeCommand = new EmployeeCommand(_connectionString);
                //list that comes from the database will be added to Emplyees Bindable collection
                Employees.AddRange(employeeCommand.GetList());

                CompanyCommand companyCommand = new CompanyCommand(_connectionString);
                //list that comes from the database will be added to Emplyees Bindable collection
                Companies.AddRange(companyCommand.GetList());
            }
            catch (Exception ex)
            {
                AppStatus = ex.Message;
                NotifyOfPropertyChange(() => AppStatus);
            }
        }
예제 #5
0
        public override async Task InitializeAsync()
        {
            await base.InitializeAsync();

            Companies.AddRange(Company.CompanyRepository);
        }