Exemple #1
0
        public ActionResult Create([Bind(Include = "MAND,TENND,MATKHAU")] Nguoidung nguoidung)
        {
            if (ModelState.IsValid)
            {
                db.Nguoidungs.Add(nguoidung);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(nguoidung));
        }
        public ActionResult Themmoi([Bind(Include = "MASV,HOSV,TENSV,ANHDAIDIEN,QUEQUAN,NGAYSINHSV,CMNDSV,DIEM_TBTL,SDTSV,SDT_PHUHUYNH,EMAIL,DIACHI_SV,DIACHI_THUONGTRU,GIOITINH,TRANGTHAISV,MACN")] Sinhvien sinhvien)
        {
            if (ModelState.IsValid)
            {
                db.Sinhviens.Add(sinhvien);
                db.SaveChanges();
                return(RedirectToAction("DanhsachSinhvien"));
            }

            ViewBag.MACN = new SelectList(db.Chuyennganhs, "MACN", "TENCN", sinhvien.MACN);
            return(View(sinhvien));
        }
        public ActionResult Themmoi(Detai detai)
        {
            if (ModelState.IsValid)
            {
                db.Detais.Add(detai);
                db.SaveChanges();
                return(RedirectToAction("DanhsachDeTai", "Detai"));
            }

            ViewBag.MALDT = new SelectList(db.LoaiDTs, "MALDT", "TENLDT", detai.MALDT);
            return(View(detai));
        }
Exemple #4
0
        public ActionResult Create([Bind(Include = "SoPGDT,Ngaygiao,Hannop,MASV,MADT,MAGV")] Phieugiaodetai phieugiaodetai)
        {
            if (ModelState.IsValid)
            {
                db.Phieugiaodetais.Add(phieugiaodetai);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MASV = new SelectList(db.Sinhviens, "MASV", "HOSV", phieugiaodetai.MASV);
            ViewBag.MADT = new SelectList(db.Detais, "MADT", "TENDT", phieugiaodetai.MADT);
            ViewBag.MAGV = new SelectList(db.Giangviens, "MAGV", "HOGV", phieugiaodetai.MAGV);
            return(View(phieugiaodetai));
        }
        public ActionResult Themmoi(Giangvien giangvien)
        {
            if (ModelState.IsValid)
            {
                db.Giangviens.Add(giangvien);
                db.SaveChanges();
                return(RedirectToAction("DanhsachGiangvien", "Giangvien"));
            }

            ViewBag.MACV = new SelectList(db.Chucvus, "MACV", "TENCV", giangvien.MACV);
            ViewBag.MACN = new SelectList(db.Chuyennganhs, "MACN", "TENCN", giangvien.MACN);
            ViewBag.MADV = new SelectList(db.Donvis, "MADV", "TENDV", giangvien.MADV);
            ViewBag.MAHV = new SelectList(db.Hocvis, "MAHV", "TENHV", giangvien.MAHV);
            return(View(giangvien));
        }
        public Student AddStudent(Student student)
        {
            var addedStudent = _entities.Students.Add(new Student()
            {
                Grade = student.Grade,
                Name  = student.Name
            });

            _entities.SaveChanges();

            return(addedStudent);
        }