Пример #1
0
        public static void Seed(IApplicationBuilder app)
        {
            TelefonRehberiContext context = app.ApplicationServices.GetRequiredService <TelefonRehberiContext>();


            context.Database.Migrate();


            if (!context.Departmanlar.Any())
            {
                context.Departmanlar.AddRange(
                    new Departman()
                {
                    DepartmanAdi = "IT"
                }

                    );
                context.SaveChanges();
            }

            if (!context.Calisanlar.Any())
            {
                context.Calisanlar.AddRange(
                    new Calisan()
                {
                    CalisanAdi = "Samet", CalisanSoyadi = "Irkoren", Telefon = "05059799591", YoneticiId = 1, DepartmanId = 1
                }



                    );
                context.SaveChanges();
            }
        }
Пример #2
0
        public void UpdateAdmin(Admin entity)
        {
            var admin = GetById(entity.AdminId);

            if (admin != null)
            {
                admin.Eposta = entity.Eposta;
                admin.Sifre  = entity.Sifre;
                context.SaveChanges();
            }

            context.SaveChanges();
        }
 public void AddDepartman(Departman entity)
 {
     context.Departmanlar.Add(entity);
     context.SaveChanges();
 }
 public void AddCalisan(Calisan entity)
 {
     context.Calisanlar.Add(entity);
     context.SaveChanges();
 }