Esempio n. 1
0
        public void Sach(TestMVCDbContext context)
        {
            if (!context.NhanViens.Any())
            {
                A.Configure <Sach>()
                .Fill(s => s.Name);
                var sach = A.ListOf <Sach>(50);
                context.Saches.AddRange(sach);
                context.SaveChanges();
                //context.Suppliers.Add(new Supplier()
                //{
                //    Name = "SamSung Viet Nam",
                //    CodeName = "SSVN",
                //    Email = "*****@*****.**",
                //    Phone = "0971489926"
                //});
                //context.SaveChanges();

                //context.Suppliers.Add(new Supplier()
                //{
                //    Name = "LG Viet Nam",
                //    CodeName = "LGVN",
                //    Email = "*****@*****.**",
                //    Phone = "0971489926"
                //});
                //context.SaveChanges();
            }
        }
Esempio n. 2
0
        private void DbContextSeed(TestMVCDbContext context, int retry = 0)
        {
            int retryForAvaiability = retry;

            try
            {
                Sach(context);
                //ChuDe(context);
                //Sach(context);
                //NhaXuatBan(context);
            }
            catch (Exception ex)
            {
                if (retryForAvaiability < 10)
                {
                    retryForAvaiability++;

                    DbContextSeed(context, retryForAvaiability);
                }
            }
        }
Esempio n. 3
0
 public ChuDeRepository(TestMVCDbContext context)
 {
     _context = context;
 }
 public NhanVienRepository(TestMVCDbContext context)
 {
     _context = context;
 }
 public HopDongRepository(TestMVCDbContext context)
 {
     _context = context;
 }
Esempio n. 6
0
 public DocGiaRepository(TestMVCDbContext context)
 {
     _context = context;
 }
Esempio n. 7
0
 public SachRepository(TestMVCDbContext context)
 {
     _context = context;
 }
 public NhaXuatBanRepository(TestMVCDbContext context)
 {
     _context = context;
 }