Пример #1
0
        public ActionResult UserDetail()
        {
            UserDetail_Model model = new UserDetail_Model();
            var hocSinh            = hocSinhRepository.GetHocSinhByTaiKhoanID((int)Session["TaiKhoanID_session"]);
            var taiKhoan           = taiKhoanRepository.GetById((int)Session["TaiKhoanID_session"]);

            model.HocSinhID = hocSinh.HocSinhID;
            model.TenHS     = hocSinh.TenHS;
            model.Email     = hocSinh.Email;
            model.Username  = taiKhoan.UserName;
            model.Role      = taiKhoan.Role;
            model.GioiTinh  = hocSinh.GioiTinh;
            DateTime ngaySinh = (DateTime)hocSinh.NgaySinh;

            model.NgaySinh = ngaySinh.ToString("yyyy-MM-dd");

            return(View(model));
        }
        // GET: Admin/HocSinhManagement/Edit/5
        public ActionResult Edit(int id)
        {
            HocSinh_TaiKhoan_Model viewModel = new HocSinh_TaiKhoan_Model();
            HocSinh hocSinh = hocSinhRepository.GetById(id);

            viewModel.HocSinhID  = id;
            viewModel.TaiKhoanID = hocSinh.TaiKhoanID;
            viewModel.TenHS      = hocSinh.TenHS;
            viewModel.NgaySinh   = hocSinh.NgaySinh;
            viewModel.GioiTinh   = hocSinh.GioiTinh;
            viewModel.Email      = hocSinh.Email;

            if (hocSinh.TaiKhoanID != null)
            {
                TaiKhoan taiKhoan = taiKhoanRepository.GetById((int)hocSinh.TaiKhoanID);
                viewModel.UserName = taiKhoan.UserName;
                viewModel.Password = taiKhoan.Password;
                viewModel.Role     = taiKhoan.Role;
            }
            return(View(viewModel));
        }
Пример #3
0
        // GET: Admin/GiaoVienManagement/Edit/5
        public ActionResult Edit(int id)
        {
            GiaoVien_TaiKhoan_Model viewModel = new GiaoVien_TaiKhoan_Model();
            GiaoVien giaoVien = giaoVienRepository.GetById(id);
            TaiKhoan taiKhoan = taiKhoanRepository.GetById((int)giaoVien.TaiKhoanID);

            viewModel.GiaoVienID = giaoVien.GiaoVienID;
            viewModel.TaiKhoanID = giaoVien.TaiKhoanID;
            viewModel.TenGV      = giaoVien.TenGV;
            viewModel.NgaySinh   = giaoVien.NgaySinh;
            viewModel.GioiTinh   = giaoVien.GioiTinh;
            viewModel.Email      = giaoVien.Email;
            viewModel.MonHocID   = giaoVien.MonHocID;
            viewModel.HocViID    = giaoVien.HocViID;

            viewModel.UserName = taiKhoan.UserName;
            viewModel.Password = taiKhoan.Password;
            viewModel.Role     = taiKhoan.Role;
            ViewBag.HocViID    = new SelectList(hocViRepository.GetAll(), "HocViID", "TenHocVi", giaoVien.HocViID);
            ViewBag.MonHocID   = new SelectList(monHocRepository.GetAll(), "MonHocID", "TenMH", giaoVien.MonHocID);
            //ViewBag.TaiKhoanID = new SelectList(taiKhoanRepository.GetAll(), "TaiKhoanID", "UserName", viewModel.giaoVien.TaiKhoanID);
            return(View(viewModel));
        }