public bool ArizaGuncelle(Arızalar ariza) { try { db.Entry(ariza).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
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 KullaniciGuncelle(Kullanicilar kullanicilar) { bool res = false; try { db.Entry(kullanicilar).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); res = true; } catch (Exception) { res = false; } return(res); }
public bool Kategori2Guncelle(Kategori_2 Kategori_2) { bool res = false; try { db.Entry(Kategori_2).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); res = true; } catch (Exception) { res = false; } return(res); }
public bool PersonelGuncelle(Personel personel) { bool res = false; try { db.Entry(personel).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); res = true; } catch (Exception ex) { res = false; } return(res); }
public Tokens Login(Kullanicilar kullanici) { Kullanicilar isThereUser = null; using (var db1 = new dbATUEntities()) { db.Configuration.LazyLoadingEnabled = false; /* isThereUser = (from kl in db1.Kullanicilar * where kl.KullaniciAdi == kullanici.KullaniciAdi && kl.Sifre == kullanici.Sifre * select kl) * .FirstOrDefault<Kullanicilar>();*/ isThereUser = db.Kullanicilar.Where(a => a.KullaniciAdi == kullanici.KullaniciAdi && a.Sifre == kullanici.Sifre) .Include(p => p.Personel) .Include(p => p.KullaniciGruplari) .Include(p => p.Personel.Ekipler) .FirstOrDefault(); /*select new Kullanicilar() * { * KullaniciAdi = kl.KullaniciAdi, * KullaniciNo = kl.KullaniciNo, * PersonelNo = kl.PersonelNo, * KullaniciGrubu = kl.KullaniciGrubu * * }*/ } if (isThereUser != null) { Tokens res = new Tokens(); res.Kullanicilar = isThereUser; res.KullaniciNo = isThereUser.KullaniciNo; // PersonelDAL personelDAL = new PersonelDAL(); res.Token = RandomString(40); res.Kullanicilar = isThereUser; // res.Kullanicilar.Personel = personelDAL.getPersonelById(isThereUser.PersonelNo); db.Entry(res.Kullanicilar).State = System.Data.Entity.EntityState.Modified; if (isThereUser.Tokens.Count == 0) { db.Tokens.Add(res); db.SaveChanges(); } else { Tokens tokens = isThereUser.Tokens.First <Tokens>(); isThereUser.Tokens.Clear(); res.Token = tokens.Token; } res.Kullanicilar.KullaniciAdi = ""; res.Kullanicilar.Sifre = ""; res.Kullanicilar.Personel.KimlikNo = 0; return(res); } else { return(null); } }