public bool KisiSil(Ekipler ekip) { bool res = false; try { Ekipler ekipler = this.getEkipById(ekip); PersonelDAL personelDal = new PersonelDAL(); foreach (var p in ekip.Personel) { Personel personel = db.Personel.Where(a => a.PersonelNo == p.PersonelNo).FirstOrDefault(); ekipler.Personel.Remove(personel); } db.Entry(ekipler).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); res = true; } catch (Exception ex) { res = false; } return(res); }
public bool KisiEkle(Ekipler ekip) { bool res = false; try { PersonelDAL personelDal = new PersonelDAL(); foreach (var p in ekip.Personel) { db.Personel.Add(p); db.Personel.Attach(p); db.Ekipler.Add(ekip); db.Ekipler.Attach(ekip); } db.SaveChanges(); res = true; } catch (Exception ex) { res = false; } return(res); }