public user_table CheckUserName(string name) { using (Notice_boardEntities2 db = new Notice_boardEntities2()) { return db.user_table.SingleOrDefault(x2 => x2.User_name == name); } }
public Klass CheckklassName(string klassName) { using (Notice_boardEntities2 db = new Notice_boardEntities2()) { return db.Klasses.SingleOrDefault(x => x.Name == klassName); } }
public Klass getOneKlass(int? id) { using (Notice_boardEntities2 db = new Notice_boardEntities2()) { return db.Klasses.SingleOrDefault(x => x.Id == id); } }
public List<Klass> getAllKlass() { using (Notice_boardEntities2 db = new Notice_boardEntities2()) { return db.Klasses.ToList(); } }
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(); } }
public void addKlass(Klass obj) { using (Notice_boardEntities2 db = new Notice_boardEntities2()) { db.Klasses.Add(obj); db.SaveChanges(); } }
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(); } }
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(); } }