Exemple #1
0
        public IQueryable <Arızalar> GetArizaByKategori(Kategori_2 kategori)
        {
            IQueryable <Arızalar> arızalar =
                db.Arızalar.Where(x => x.Kat2 == kategori.KategoriNo)
                .Include(x => x.Kategori_1)
                .Include(x => x.Kategori_2)
                .Include(x => x.Ekipler)
                .Include(x => x.Kullanicilar);

            return(arızalar);
        }
        public bool Kategori2Sil(Kategori_2 Kategori_2)
        {
            bool res = false;

            try
            {
                db.Kategori_2.Remove(db.Kategori_2.Find(Kategori_2.KategoriNo));
                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 Kategori2Ekle(Kategori_2 Kategori_2)
        {
            bool res = false;

            try
            {
                db.Kategori_2.Add(Kategori_2);
                db.SaveChanges();
                res = true;
            }
            catch (Exception)
            {
                res = false;
            }
            return(res);
        }
        public bool KategoriSil(Ekipler ekip)
        {
            bool res = false;

            try
            {
                Ekipler    ekipler     = this.getEkipById(ekip);
                Kategori_2 personelDal = new Kategori_2();
                foreach (var p in ekip.Kategori_2)
                {
                    Kategori_2 personel = db.Kategori_2.Where(a => a.KategoriNo == p.KategoriNo).FirstOrDefault();
                    ekipler.Kategori_2.Remove(personel);
                }
                db.Entry(ekipler).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                res = true;
            }
            catch (Exception ex)
            {
                res = false;
            }
            return(res);
        }
        public Kategori_2 getKategori2ById(Kategori_2 kategori_2)
        {
            Kategori_2 res = db.Kategori_2.Find(kategori_2.KategoriNo);

            return(res);
        }