示例#1
0
 public  user_table CheckUserName(string name)
   {
       using (Notice_boardEntities2 db = new Notice_boardEntities2())
       {
           return db.user_table.SingleOrDefault(x2 => x2.User_name == name);
       }
   }
示例#2
0
 public Klass CheckklassName(string klassName)
    {
        using (Notice_boardEntities2 db = new Notice_boardEntities2())
        {
            return db.Klasses.SingleOrDefault(x => x.Name == klassName);
        }
    }
示例#3
0
 public Klass getOneKlass(int? id)
 {
     using (Notice_boardEntities2 db = new Notice_boardEntities2())
     {
         return db.Klasses.SingleOrDefault(x => x.Id == id);
     }
 }
示例#4
0
        public List<Klass> getAllKlass()
        {
            using (Notice_boardEntities2 db = new Notice_boardEntities2())
            {
                return db.Klasses.ToList();
            }

        }
示例#5
0
        public List<string> GetKlass(string term)
        {
            using (Notice_boardEntities2 db = new Notice_boardEntities2())
            {

             return db.Klasses.Where(x => x.Name.Contains(term)).Select(y => y.Name).ToList();
            }
        }
示例#6
0
        public void addKlass(Klass obj)
        {
            using (Notice_boardEntities2 db = new Notice_boardEntities2()) 
            {

                db.Klasses.Add(obj);
                db.SaveChanges();
            
            }
        }
示例#7
0
        public void deleteKlass(int id)
        {
            using (Notice_boardEntities2 db = new Notice_boardEntities2())
            {

                var q=db.Klasses.SingleOrDefault(x=>x.Id == id);
                db.Klasses.Remove(q);
                db.SaveChanges();

            }
        }
示例#8
0
        public void editKlass(Klass obj)
        {
            using (Notice_boardEntities2 db = new Notice_boardEntities2())
            {

                obj.Name = obj.Name;
                obj.Degree = obj.Degree;
                obj.Date = DateTime.Today;
                db.SaveChanges();
            }

        }