Example #1
0
        public static Kullanici Kullanici(string adSoyad, string kullaniciAdi, string ePosta, string sifre, string istenilenYetki)
        {
            Context ctx = new Context();

            Kullanici kullanici = new Kullanici();

            kullanici.adSoyad      = adSoyad;
            kullanici.ePosta       = ePosta;
            kullanici.kullaniciAdi = kullaniciAdi;
            kullanici.sifre        = sifre;

            Yetki yetki = ctx.Yetkis.FirstOrDefault(x => x.ad == istenilenYetki);

            if (yetki != null)
            {
                kullanici.Yetkis.Add(yetki);

                ctx.Kullanicis.Add(kullanici);

                yetki.Kullanicis.Add(kullanici);

                return(kullanici);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        public static Yetki Yetki(string ad)
        {
            Context ctx = new Context();

            Yetki yetki = new Yetki();

            yetki.ad = ad;

            ctx.Yetkis.Add(yetki);

            return(yetki);
        }
Example #3
0
        public static bool Yetki(int yetkiID, string yeniAd)
        {
            bool sonuc = false;

            Context ctx = new Context();

            Yetki yetki = ctx.Yetkis.SingleOrDefault(x => x.yetkiID == yetkiID);

            if (yetki != null)
            {
                yetki.ad = yeniAd;

                sonuc = true;
            }

            return(sonuc);
        }
Example #4
0
        public static bool Yetki(int yetkiID)
        {
            bool sonuc = false;

            Context ctx = new Context();

            Yetki yetki = ctx.Yetkis.SingleOrDefault(x => x.yetkiID == yetkiID);

            if (yetki != null)
            {
                if (yetki.Kullanicis.Count == 0)
                {
                    ctx.Yetkis.Remove(yetki);

                    sonuc = true;
                }
                else
                {
                    sonuc = false;
                }
            }

            return(sonuc);
        }