public NhanVienBusiness() { _dbContext = new SMSEntities(); _chucVuRepo = new ChucVuRepository(_dbContext); _nhanVienRepo = new NhanVienRepository(_dbContext); _nhanVienQuyenRepo = new NhanVien_QuyenRepository(_dbContext); }
public ActionResult Create() { var cvs = ChucVuRepository.GetAll().Select(x => x.ToDataInfo()).ToList(); var roles = RoleRepository.GetAll().Select(x => x.ToRoleViewModel()).ToList(); var cqs = CoQuanRepository.GetAll().Select(x => x.ToDataInfo()).ToList(); var userInfo = new AddUserViewModel { RoleInfos = roles, ChucVuInfos = cvs, CoQuanInfos = cqs, }; return(View(userInfo)); }
public UnitOfWork(HeThongQuanLyVPGTContext context) { DanhSachBienBan = new BienBanRepository(context); DanhSachNguoiDieuKhien = new NguoiDieuKhienRepository(context); DanhSachPhuongTien = new PhuongTienRepository(context); DanhSachCanBo = new CanBoRepository(context); DanhSachBangLai = new BangLaiRepository(context); DanhSachCapBac = new CapBacRepository(context); DanhSachChucVu = new ChucVuRepository(context); DanhSachChuyenDe = new ChuyenDeRepository(context); DanhSachDieuLuat = new DieuLuatRepository(context); DanhSachDoi = new DoiRepository(context); DanhSachQuyen = new QuyenRepository(context); DanhSachTaiKhoan = new TaiKhoanRepository(context); DanhSachTuyenDuong = new TuyenDuongRepository(context); DanhSachKhuVuc = new KhuVucRepository(context); DanhSachTheLoaiPhuongTien = new TheLoaiPhuongTienRepository(context); _context = context; }
public ActionResult Edit(int id) { var user = UserRepository.Single(id); var chucvu = ChucVuRepository.GetAll().Select(x => x.ToDataInfo()); var coQuan = CoQuanRepository.GetAll().Select(x => x.ToDataInfo()); var userRole = UserRoleRepository.GetRolesByUserId(id); var roles = RoleRepository.GetAll().ToList(); roles.ForEach(x => { userRole.ToList().ForEach(y => { if (y.RoleId == x.Id) { x.IsChecked = true; } }); }); AddUserViewModel model = new AddUserViewModel { Id = user.Id, FullName = user.HoVaTen, UserName = user.UserName, IsLocked = user.IsLocked, ChucVuId = user.ChucVuId, ChucVuInfos = chucvu, CoQuanId = user.CoQuanId, CoQuanInfos = coQuan, CreateDate = user.CreateDate, CreatedBy = user.CreatedBy, RoleInfos = roles.Select(x => x.ToRoleViewModel()).ToList(), }; return(View(model)); }