Beispiel #1
0
        public ActionResult ThemDkthaydoidiachi(phieuthaydoidiachi tddc)
        {
            if (Session["LoggedSV"] == null || Session["LoggedSV"].ToString() == "")
            {
                TempData["Login"] = "******";
                return(RedirectToAction("Index", "Home"));
            }
            try
            {
                sinhvien sv = (sinhvien)Session["LoggedSV"];
                ViewBag.sinhvien = sv.Tensv;
                tddc.Masv        = sv.Masv;
                tddc.TrangThai   = 0;
                db.phieuthaydoidiachis.InsertOnSubmit(tddc);
                db.SubmitChanges();
                TempData["message"] = "success";
            }
            catch (Exception ex)
            {
                TempData["message"] = "fail";
            }

            TempData["message2"] = "add";
            return(RedirectToAction("DanhSachPhieu"));
        }
 public ActionResult DuyetDkthaydoidiachi(int id)
 {
     if (Session["LoggedAD"] == null || Session["LoggedAD"].ToString() == "")
     {
         return(RedirectToAction("Login", "Admin"));
     }
     try
     {
         phieuthaydoidiachi tddc = db.phieuthaydoidiachis.SingleOrDefault(m => m.Maphieuthaydoidiachi == id);
         tddc.TrangThai = 1;
         db.SubmitChanges();
         TempData["message"] = "success";
     }
     catch (Exception ex)
     {
         TempData["message"] = "fail";
     }
     TempData["message2"] = "revise";
     return(RedirectToAction("Sinhvien"));
 }