public ActionResult Index(int ID)
        {
            KHOA_HOC course = db.KHOA_HOC.SingleOrDefault(x => x.IDKhoaHoc == ID);
            BAI_HOC  lesson = course.BAI_HOC.Skip(0).Take(1).FirstOrDefault();

            ViewBag.IdLesson = lesson.IDBaiHoc;
            return(View(course.BAI_HOC.ToList()));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            BAI_HOC bAI_HOC = db.BAI_HOC.Find(id);

            db.BAI_HOC.Remove(bAI_HOC);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Display()
        {
            int     idlesson = int.Parse(Request.QueryString["IDLesson"]);
            int     idcourse = int.Parse(Request.QueryString["IDCourse"]);
            BAI_HOC lesson   = db.BAI_HOC.SingleOrDefault(x => x.IDBaiHoc == idlesson);

            ViewBag.IdLesson = lesson.IDBaiHoc;
            List <BAI_HOC> listbaihoc = db.BAI_HOC.Where(x => x.IDKhoaHoc == idcourse).ToList();

            return(View("Index", listbaihoc));
        }
 public ActionResult Edit([Bind(Include = "IDBaiHoc,TenBaiHoc,MoTaBaiHoc,IDKhoaHoc,NoiDungBaiHoc")] BAI_HOC bAI_HOC)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bAI_HOC).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IDKhoaHoc = new SelectList(db.KHOA_HOC, "IDKhoaHoc", "TenKhoaHoc", bAI_HOC.IDKhoaHoc);
     return(View(bAI_HOC));
 }
        // GET: Management/LessonManagerment/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BAI_HOC bAI_HOC = db.BAI_HOC.Find(id);

            if (bAI_HOC == null)
            {
                return(View("eror404"));
            }
            return(View(bAI_HOC));
        }
        // GET: Management/LessonManagerment/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BAI_HOC bAI_HOC = db.BAI_HOC.Find(id);

            if (bAI_HOC == null)
            {
                return(HttpNotFound());
            }
            return(View(bAI_HOC));
        }
        // GET: Management/LessonManagerment/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BAI_HOC bAI_HOC = db.BAI_HOC.Find(id);

            if (bAI_HOC == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IDKhoaHoc = new SelectList(db.KHOA_HOC, "IDKhoaHoc", "TenKhoaHoc", bAI_HOC.IDKhoaHoc);
            return(View(bAI_HOC));
        }