예제 #1
0
        public static void Initialize(TnContext context)
        {
            if (context.EmployeesBase.Any())
            {
                return;
            }
            for (var i = 1; i < 99; i++)
            {
                var     random  = new Random();
                decimal randNum = random.Next(100);
                if (randNum < 50)
                {
                    context.EmployeesOnSalary.Add(
                        new EmployeeOnSalary
                    {
                        Name          = "Иванов Иван" + i.ToString().PadLeft(3, '0'),
                        MonthlySalary = 100000 * (1 + randNum / 100)
                    }
                        );
                }
                else
                {
                    context.EmployeesOnRate.Add(
                        new EmployeeOnRate
                    {
                        Name       = "Иванов Иван" + i.ToString().PadLeft(3, '0'),
                        HourlyRate = 1000 * (1 + randNum / 100)
                    }
                        );
                }
            }

            context.SaveChanges();
        }
예제 #2
0
파일: TnRepo.cs 프로젝트: Konan777/TechnoN
 public EmployeeRepo(TnContext context)
 {
     _context = context;
 }