示例#1
0
        public ActionResult ThemDiem(DiemMon DIEM, HttpPostedFileBase fileupload)
        {
            DiemMon diem = db.DiemMons.SingleOrDefault(n => n.MaDiemMon == DIEM.MaDiemMon);

            // Lưu vào CSDL
            if (ModelState.IsValid)
            {
                db.DiemMons.InsertOnSubmit(DIEM);
                db.SubmitChanges();
            }
            return(RedirectToAction("Index"));
        }
示例#2
0
        public ActionResult XoaDiem(int id)
        {
            //Lấy ra đối tượng sách cần xóa theo mã
            DiemMon diem = db.DiemMons.SingleOrDefault(n => n.MaDiemMon == id);

            ViewBag.MaDiemMon = diem.MaDiemMon;
            if (diem == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            return(View(diem));
        }
示例#3
0
        public ActionResult XacnhanxoaDiem(int id)
        {
            //Lấy ra đối tượng sách cần xóa theo mã
            DiemMon diem = db.DiemMons.SingleOrDefault(n => n.MaDiemMon == id);

            ViewBag.MaDiemMon = diem.MaDiemMon;
            if (diem == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            db.DiemMons.DeleteOnSubmit(diem);
            db.SubmitChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult SuaDiem(int id)
        {
            //Lấy ra đối tượng sách cần sửa theo mã
            DiemMon diem = db.DiemMons.SingleOrDefault(n => n.MaDiemMon == id);

            if (diem == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            ViewBag.MaHS    = new SelectList(db.HocSinhs.ToList().OrderBy(n => n.HoTen), "MaHS", "HoTen");
            ViewBag.MaHocKy = new SelectList(db.HocKies.ToList().OrderBy(n => n.TenHocKy), "MaHocKy", "TenHocKy");
            ViewBag.MaMon   = new SelectList(db.MonHocs.ToList().OrderBy(n => n.TenMon), "MaMon", "TenMon");
            return(View(diem));
        }
示例#5
0
        public ActionResult ThemDiem(int id)
        {
            DiemMon diem = db.DiemMons.SingleOrDefault(n => n.MaDiemMon == id);

            if (diem == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            ViewBag.MaHS     = new SelectList(db.HocSinhs.ToList().OrderBy(n => n.HoTen), "MaHS", "HoTen");
            ViewBag.MaHocKy  = new SelectList(db.HocKies.ToList().OrderBy(n => n.TenHocKy), "MaHocKy", "TenHocKy");
            ViewBag.MaMon    = new SelectList(db.MonHocs.ToList().OrderBy(n => n.TenMon), "MaMon", "TenMon");
            ViewBag.MaNamHoc = new SelectList(db.NamHocs.ToList().OrderBy(n => n.TenNamHoc), "MaNamHoc", "TenNamHoc");
            ViewBag.MaLop    = new SelectList(db.Lops.ToList().OrderBy(n => n.TenLop), "MaLop", "TenLop");
            return(View(diem));
        }
        public ActionResult SuaDiem(DiemMon DIEM)
        {
            ViewBag.MaHS    = new SelectList(db.HocSinhs.ToList().OrderBy(n => n.HoTen), "MaHS", "HoTen");
            ViewBag.MaHocKy = new SelectList(db.HocKies.ToList().OrderBy(n => n.TenHocKy), "MaHocKy", "TenHocKy");
            ViewBag.MaMon   = new SelectList(db.MonHocs.ToList().OrderBy(n => n.TenMon), "MaMon", "TenMon");
            var diem = db.DiemMons.SingleOrDefault(n => n.MaDiemMon == DIEM.MaDiemMon);

            // Lưu vào CSDL
            if (ModelState.IsValid)
            {
                diem.Diem15phut = DIEM.Diem15phut;
                diem.Diem1Tiet  = DIEM.Diem1Tiet;
                diem.DiemHK     = DIEM.DiemHK;
                diem.DiemTB     = DIEM.DiemTB;
                db.SubmitChanges();
            }
            return(RedirectToAction("Mark"));
        }