public ActionResult Formthemphieumuon(string id)
 {
     Models.THEDOCGIA tHEDOCGIA = dc.THEDOCGIAs.Find(id);
     ViewBag.mathedocgia = tHEDOCGIA.MaTheDocGia;
     ViewBag.DsSach      = dc.SACHes.ToList();
     ViewBag.Dsthedocgia = dc.THEDOCGIAs.ToList();
     return(View());
 }
        public override bool IsValid(object value)
        {
            string MaTheDocGia = value.ToString();

            Models.THEDOCGIA a = dc.THEDOCGIAs.Find(MaTheDocGia);
            if (a == null)
            {
                return(true);
            }
            return(false);
        }
 public ActionResult xoathedocgia(string id)
 {
     Models.THEDOCGIA tHEDOCGIA = dc.THEDOCGIAs.Find(id);
     if (tHEDOCGIA != null)
     {
         dc.THEDOCGIAs.Remove(tHEDOCGIA);
         dc.SaveChanges();
     }
     ViewBag.mathedocgia = tHEDOCGIA.MaTheDocGia;
     ViewBag.DsSach      = dc.SACHes.ToList();
     ViewBag.Dsthedocgia = dc.THEDOCGIAs.ToList();
     return(RedirectToAction("IndexTDG"));
 }
        public ActionResult Formxoathedocgia(string id)
        {
            Models.THEDOCGIA tHEDOCGIA = dc.THEDOCGIAs.Find(id);
            ViewBag.mathedocgia = tHEDOCGIA.MaTheDocGia;
            ViewBag.DsSach      = dc.SACHes.ToList();
            ViewBag.Dsthedocgia = dc.THEDOCGIAs.ToList();
            bool coXoa = true;

            foreach (Models.PHIEUMUON t in dc.PHIEUMUONs.Where(x => x.MaTheDocGia == id))
            {
                coXoa = false;
                break;
            }
            ViewBag.XoaThehocvien = coXoa;
            if (tHEDOCGIA != null)
            {
                return(View(tHEDOCGIA));
            }
            return(RedirectToAction("IndexTDG"));
        }