public ActionResult Create()
 {
     ViewBag.NienKhoa = new SelectList(contextNKHK.GetNienKhoa(), "NienKhoa", "NienKhoa");
     ViewBag.MaGV     = new SelectList(contextGV.GetALL(), "MaGV", "TenDayDu");
     ViewBag.MaMonHoc = new SelectList(contextMH.GetAll(), "MaMH", "TenMH");
     return(View());
 }
        public ActionResult Create()
        {
            ThoiKhoaBieuBLL     contextTKB = new ThoiKhoaBieuBLL();
            List <ThoiKhoaBieu> lstTKB     = contextTKB.GetAll();
            GiangVienBLL        contextGV  = new GiangVienBLL();
            MonHocBLL           contextMH  = new MonHocBLL();

            List <GiangVienModel> listGVModel = contextGV.GetAll().Select(x => new GiangVienModel
            {
                Email      = x.Email,
                GioiTinh   = x.GioiTinh,
                HoVaTenLot = x.HoVaTenLot,
                MaGV       = x.MaGV,
                MaKhoa     = x.MaKhoa,
                MatKhau    = x.MatKhau,
                NgaySinh   = x.NgaySinh,
                SDT        = x.SDT,
                TenGV      = x.TenGV,
                TrinhDo    = x.TrinhDo
            }).ToList();
            List <MonHocModel> listMH = contextMH.GetAll().Select(x => new MonHocModel
            {
                MaMH             = x.MaMH,
                SoTinChiLyThuyet = x.SoTinChiLyThuyet,
                SoTinChiThucHanh = x.SoTinChiThucHanh,
                TenMH            = x.TenMH
            }).ToList();
            List <LopTinChi> lstLTC = contextLTC.GetAll();

            lstLTC = contextLTC.GetListLTCOpen(lstLTC);

            List <LopTinChi> lstLTCNew = new List <LopTinChi>();

            foreach (LopTinChi item in lstLTC)
            {
                var query = lstTKB.Where(x => x.MaLopTC == item.MaLopTC).FirstOrDefault();
                if (query == null)
                {
                    lstLTCNew.Add(item);
                }
            }

            SelectList selectList = new SelectList(lstLTCNew, "MaLopTC", "MaLopTC");

            ViewBag.GiangVienModel = new SelectList(listGVModel, "MaGV", "TenDayDu");
            ViewBag.MonHocModels   = new SelectList(listMH, "MaMH", "TenMH");
            ViewBag.LopTCDuocMo    = selectList;
            ViewBag.MaLopTC        = new SelectList(lstLTC, "MaLopTC", "MaLopTC");
            return(View());
        }
Exemple #3
0
 public ActionResult Index()
 {
     return(View(contextMH.GetAll()));
 }