Пример #1
0
        public void DeleteUser(int Id, int uid)
        {
            Class.AppContext ac = new Class.AppContext();
            var c = (from std in ac.Students
                     where std.Id == Id
                     select std).First();

            if (c.Id != 1)
            {
                ac.Students.Remove(c);
                ac.SaveChanges();
            }
        }
Пример #2
0
        public void InsertLesson(Lesson ls)
        {
            Class.AppContext ac = new Class.AppContext();
            var c = (from per in ac.Students
                     where per.Id == ls.StudentId
                     select per).FirstOrDefault();

            if (c.DersSayisi <= 29)
            {
                c.DersSayisi++;
                ac.Lessons.Add(ls);
                ac.SaveChanges();
            }
        }
Пример #3
0
        public void UpdateUser(Student user)
        {
            Class.AppContext ac = new Class.AppContext();
            var c = (from std in ac.Students
                     where std.Id == user.Id
                     select std).First();

            c.AdSoyad        = user.AdSoyad;;
            c.EMail          = user.EMail;
            c.GizliSoru      = user.GizliSoru;
            c.GizliSoruCevap = user.GizliSoruCevap;
            c.KullaniciAdi   = user.KullaniciAdi;
            c.Oturum         = user.Oturum;
            c.Sifre          = user.Sifre;
            ac.SaveChanges();
        }
Пример #4
0
        public bool DeleteLesson(int Id, int uid)
        {
            Class.AppContext ac = new Class.AppContext();
            var c = (from less in ac.Lessons
                     where less.Id == Id & less.StudentId == uid
                     select less).FirstOrDefault();

            if (c != null)
            {
                ac.Lessons.Remove(c);
                ac.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
        public bool ChangePassword(Student s)
        {
            Class.AppContext ac = new Class.AppContext();
            var c = (from per in ac.Students
                     where per.KullaniciAdi == s.KullaniciAdi
                     & per.GizliSoru == s.GizliSoru & per.GizliSoruCevap == s.GizliSoruCevap & per.EMail == s.EMail
                     select per).FirstOrDefault();

            if (c != null)
            {
                c.Sifre = s.Sifre;
                ac.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
        public void UpdateLesson(Lesson ls, int uid)
        {
            Class.AppContext ac = new Class.AppContext();
            var c = (from less in ac.Lessons
                     where less.Id == ls.Id & less.StudentId == uid
                     select less).FirstOrDefault();

            if (c != null)
            {
                c.Adi         = ls.Adi;
                c.VizeTahmin  = ls.VizeTahmin;
                c.Vize        = ls.Vize;
                c.VizeDurum   = ls.VizeDurum;
                c.FinalTahmin = ls.FinalTahmin;
                c.Final       = ls.Final;
                c.FinalDurum  = ls.FinalDurum;
                c.BütTahmin   = ls.BütTahmin;
                c.Büt         = ls.Büt;
                c.GecmeNotu   = ls.GecmeNotu;
                c.GecerNot    = ls.GecerNot;
                ac.SaveChanges();
            }
        }
Пример #7
0
 public void SignUp(Student s)
 {
     Class.AppContext ac = new Class.AppContext();
     ac.Students.Add(s);
     ac.SaveChanges();
 }