public ActionResult DeleteConfirmed(int id) { NienKhoa nienKhoa = db.NienKhoas.Find(id); db.NienKhoas.Remove(nienKhoa); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name")] NienKhoa nienKhoa) { if (ModelState.IsValid) { db.Entry(nienKhoa).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nienKhoa)); }
public ActionResult Create([Bind(Include = "Id,Name")] NienKhoa nienKhoa) { if (ModelState.IsValid) { db.NienKhoas.Add(nienKhoa); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nienKhoa)); }
// GET: NienKhoas/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } NienKhoa nienKhoa = db.NienKhoas.Find(id); if (nienKhoa == null) { return(HttpNotFound()); } return(View(nienKhoa)); }
public List <NienKhoa> GetKhoaHoc() { try { var d = myExecuteReader("SELECT * FROM KhoaHoc"); var list = new List <NienKhoa>(); while (d.Read()) { var khoaHoc = new NienKhoa(); khoaHoc.IdKhoaHoc = d.GetInt32(0); khoaHoc.NamHoc = d.GetInt32(1); list.Add(khoaHoc); } return(list); } catch (Exception) { throw; } }