public Table getSubjects(int ID) { var db = new TKBEntities(); var subject = db.Tables.Find(ID); return(subject); }
public List <Table> getSubject() { var db = new TKBEntities(); List <Table> subject = db.Tables.ToList(); return(subject); }
public void deleteSubject(int id) { var db = new TKBEntities(); var subject = db.Tables.Find(id); db.Tables.Remove(subject); db.SaveChanges(); }
public void updateSubject(int id, string CaHoc, string thu2, string thu3, string thu4, string thu5, string thu6, string thu7) { var db = new TKBEntities(); var currentSubject = db.Tables.Find(id); currentSubject.Ca_Học = CaHoc; currentSubject.Thứ_Hai = thu2; currentSubject.Thứ_Ba = thu3; currentSubject.Thứ_Tư = thu4; currentSubject.Thứ_Năm = thu5; currentSubject.Thứ_Sáu = thu6; currentSubject.Thứ_Bảy = thu7; db.Entry(currentSubject).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }
public void createSubject(string CaHoc, string thu2, string thu3, string thu4, string thu5, string thu6, string thu7) { var db = new TKBEntities(); var newSubject = new Table(); newSubject.Ca_Học = CaHoc; newSubject.Thứ_Hai = thu2; newSubject.Thứ_Ba = thu3; newSubject.Thứ_Tư = thu4; newSubject.Thứ_Năm = thu5; newSubject.Thứ_Sáu = thu6; newSubject.Thứ_Bảy = thu7; db.Tables.Add(newSubject); db.SaveChanges(); db.Dispose(); }
public bool IsValidLogin(string taiKhoan, string matKhau) { TKBEntities db = new TKBEntities(); List <TaiKhoan> listTK = db.TaiKhoans.ToList(); TaiKhoan temp = new TaiKhoan(); temp.TaiKhoan1 = taiKhoan; temp.MatKhau = matKhau; bool isValid = false; for (int i = 0; i < listTK.Count; i++) { if (listTK[i].TaiKhoan1 == temp.TaiKhoan1 && listTK[i].MatKhau == temp.MatKhau) { isValid = true; } } return(isValid); }