コード例 #1
0
 public ActionResult Edit([Bind(Include = "ma,ky_hoc,bat_dau,ket_thuc")] KyHoc kyHoc)
 {
     if (ModelState.IsValid)
     {
         db.Entry(kyHoc).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(kyHoc));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ma,ten")] MonHoc monHoc)
 {
     if (ModelState.IsValid)
     {
         db.Entry(monHoc).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(monHoc));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "ma,ten,ma_khoa,ma_gv_chu_nhiem")] LopOnDinh lopOnDinh)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lopOnDinh).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ma_gv_chu_nhiem = new SelectList(db.GiaoViens, "ma", "ten", lopOnDinh.ma_gv_chu_nhiem);
     return(View(lopOnDinh));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "tai_khoan,mat_khau,ten_hien_thi,url_anh,la_admin")] TaiKhoan taiKhoan)
 {
     if (ModelState.IsValid)
     {
         db.Entry(taiKhoan).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.tai_khoan = new SelectList(db.GiaoViens, "ma", "ten", taiKhoan.tai_khoan);
     return(View(taiKhoan));
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "ma,ma_mon_hoc,ma_ky_hoc,ma_giao_vien,ma_lop_on_dinh")] LopHoc lopHoc)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lopHoc).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ma_giao_vien   = new SelectList(db.GiaoViens, "ma", "ten", lopHoc.ma_giao_vien);
     ViewBag.ma_ky_hoc      = new SelectList(db.KyHocs, "ma", "ky_hoc", lopHoc.ma_ky_hoc);
     ViewBag.ma_lop_on_dinh = new SelectList(db.LopOnDinhs, "ma", "ten", lopHoc.ma_lop_on_dinh);
     ViewBag.ma_mon_hoc     = new SelectList(db.MonHocs, "ma", "ten", lopHoc.ma_mon_hoc);
     return(View(lopHoc));
 }
コード例 #6
0
        public ActionResult Edit([Bind(Include = "ma,ten,ngay_sinh,ma_lop_on_dinh,so_dien_thoai,email,url_anh,ngay_nhap_hoc")] HocSinh hocSinh)
        {
            if (ModelState.IsValid)
            {
                if (Request.Files.Count > 0 && Request.Files[0].FileName.Trim() != "")
                {
                    string[] _arr = Request.Files[0].FileName.Split('.');
                    string   type = _arr[_arr.Length - 1];
                    hocSinh.url_anh = hocSinh.ma + "." + type;
                    Request.Files[0].SaveAs(Server.MapPath("~/Public/upload/student/") + hocSinh.url_anh);
                }

                db.Entry(hocSinh).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(hocSinh));
        }
コード例 #7
0
        public ActionResult Edit([Bind(Include = "ma,ten,ngay_sinh,url_anh,so_dien_thoai,email,ngay_vao_truong")] GiaoVien giaoVien)
        {
            if (ModelState.IsValid)
            {
                if (Request.Files.Count > 0 && Request.Files[0].FileName.Trim() != "")
                {
                    string[] _arr = Request.Files[0].FileName.Split('.');
                    string   type = _arr[_arr.Length - 1];
                    giaoVien.url_anh = giaoVien.ma + "." + type;
                    Request.Files[0].SaveAs(Server.MapPath("~/Public/upload/teacher/") + giaoVien.url_anh);
                }

                db.Entry(giaoVien).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ma = new SelectList(db.TaiKhoans, "tai_khoan", "mat_khau", giaoVien.ma);
            return(View(giaoVien));
        }
コード例 #8
0
        public ActionResult Edit([Bind(Include = "ma,noi_dung, tieu_de,do_uu_tien,tai_khoan,hinh_anh,ma_danh_muc")] BaiViet baiViet)
        {
            if (ModelState.IsValid)
            {
                if (Request.Files.Count > 0 && Request.Files[0].FileName.Trim() != "")
                {
                    string[] _arr = Request.Files[0].FileName.Split('.');
                    string   type = _arr[_arr.Length - 1];
                    baiViet.hinh_anh = baiViet.ma + "." + type;
                    Request.Files[0].SaveAs(Server.MapPath("~/Public/upload/post/") + baiViet.hinh_anh);
                }

                baiViet.noi_dung        = HttpUtility.HtmlDecode(baiViet.noi_dung.Replace(System.Environment.NewLine, ""));
                db.Entry(baiViet).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ma_danh_muc = new SelectList(db.DanhMucs, "ma", "ten", baiViet.ma_danh_muc);
            ViewBag.tai_khoan   = new SelectList(db.TaiKhoans, "tai_khoan", "mat_khau", baiViet.tai_khoan);
            return(View(baiViet));
        }