public ActionResult Create(LienHe lienhe)
        {
            if (ModelState.IsValid)
            {
                db.LienHes.Add(lienhe);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.MaTK = new SelectList(db.TaiKhoans, "MaTK", "TenTK", lienhe.MaTK);
            ViewBag.MaYC = new SelectList(db.YeuCaus, "MaYC", "TenYeuCau", lienhe.MaYC);
            return View(lienhe);
        }
 public ActionResult Index(/*FormCollection collection, */LienHe lienhe)
 {
     int matk;
     if (Session["MaTK"] == "" || Session["MaTK"] == null)
     {
         matk = 2;//tai khoan public
     }
     else
     {
         matk = int.Parse(Session["MaTK"].ToString());
     }
     DateTime ngaytao = DateTime.Today;
     if (ModelState.IsValid)
     {
         lienhe.MaTK = matk;
         lienhe.NgayTao = ngaytao;
         db.LienHes.Add(lienhe);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.MaYC = new SelectList(db.YeuCaus, "MaYC", "TenYeuCau", lienhe.MaYC);
     return View(lienhe);
 }
 public ActionResult Edit(LienHe lienhe)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lienhe).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.MaTK = new SelectList(db.TaiKhoans, "MaTK", "TenTK", lienhe.MaTK);
     ViewBag.MaYC = new SelectList(db.YeuCaus, "MaYC", "TenYeuCau", lienhe.MaYC);
     return View(lienhe);
 }