public UserRoleController(IConfiguration configuration, IMapper mapper,
     IUserRoleRepo userRoleRepo, ILogger<UserRoleController> logger) : base(logger)
 {
     Configuration = configuration;
     Mapper = mapper;
     UserRoleRepo = userRoleRepo;
 }
Ejemplo n.º 2
0
 public UserService(IUserRepo uRepo, IPrivilegeRepo pRepo, IRoleRepo rRepo, IUserRoleRepo uRRepo, IEmailSender eService)
 {
     _uRepo    = uRepo;
     _pRepo    = pRepo;
     _eService = eService;
     _rRepo    = rRepo;
     _uRRepo   = uRRepo;
 }
Ejemplo n.º 3
0
 public SysUserController(
     ISysUserRepo sysUserRepo,
     IUserRoleRepo userRoleRepo,
     IMapper mapper,
     IUnitOfWork unitOfWork
     )
 {
     this._sysUserRepo  = sysUserRepo;
     this._userRoleRepo = userRoleRepo;
     this._mapper       = mapper;
     this._unitOfWork   = unitOfWork;
 }
Ejemplo n.º 4
0
 public UserService(
     IUserRepo userRepo,
     IUserRoleRepo userRoleRepo,
     IMapper mapper,
     IOptions <AppSettings> appSettings,
     IEncryptionService encryptionService,
     IHttpContextAccessor contextAccessor,
     ISessionService sessionService)
 {
     this.userRepo          = userRepo;
     this.userRoleRepo      = userRoleRepo;
     this.mapper            = mapper;
     this.appSettings       = appSettings;
     this.encryptionService = encryptionService;
     this.sessionService    = sessionService;
 }
Ejemplo n.º 5
0
        public void Setup()
        {
            List <UserRole> UserRole = new List <UserRole>()
            {
                new UserRole {
                    userroleid = 1, userid = 1
                },
                new UserRole {
                    userroleid = 2, userid = 2
                },
                new UserRole {
                    userroleid = 3, userid = 3
                },
                new UserRole {
                    userroleid = 4, userid = 4
                },
            };

            var mockrepo = new Mock <IUserRoleRepo>();

            // add method
            mockrepo.Setup(m => m.Add(It.IsAny <UserRole>()))
            .Callback <UserRole>(a => UserRole.Add(a));
            // find all method
            mockrepo.Setup(m => m.FindAll()).Returns(UserRole);

            // find by id method
            mockrepo.Setup(m => m.FindByID(It.IsAny <int>()))
            .Returns((int i) => UserRole
                     .Where(w => w.userroleid == i).Single());

            // update method
            mockrepo.Setup(m => m.Update(It.IsAny <UserRole>()))
            .Callback <UserRole>(p => UserRole.Where(w => w.userroleid == p.userroleid).First(a =>
            {
                a.userroleid = p.userroleid; a.userid = p.userid; return(true);
            }));

            // remove method

            mockrepo.Setup(m => m.Remove(It.IsAny <int>()))
            .Callback <int>(i => UserRole.Remove(UserRole.Where(w => w.userroleid == i).First()));

            _mockrepo = mockrepo.Object;
        }
Ejemplo n.º 6
0
 public RunDataController(IAssetRepo assetRepo,
                          ICategoryRepo categoryRepo,
                          IBaseTypeRepo baseTypeRepo,
                          IBaseItemRepo baseItemRepo,
                          IFileRepo fileRepo,
                          IPermissionRepo permissionRepo,
                          IRoleRepo roleRepo,
                          IRolePermissionRepo rolePermissionRepo,
                          IUserRepo userRepo,
                          IUserRoleRepo userRoleRepo)
 {
     _assetRepo          = assetRepo;
     _categoryRepo       = categoryRepo;
     _baseTypeRepo       = baseTypeRepo;
     _baseItemRepo       = baseItemRepo;
     _fileRepo           = fileRepo;
     _permissionRepo     = permissionRepo;
     _roleRepo           = roleRepo;
     _rolePermissionRepo = rolePermissionRepo;
     _userRepo           = userRepo;
     _userRoleRepo       = userRoleRepo;
 }
Ejemplo n.º 7
0
 public UserRoleService(IUserRoleRepo userRoleRepo)
 {
     _userRoleRepo = userRoleRepo;
 }
Ejemplo n.º 8
0
 public UserService(IUserRepo userRepo, IUserRoleRepo userRoleRepo)
 {
     _userRepo     = userRepo;
     _userRoleRepo = userRoleRepo;
 }
Ejemplo n.º 9
0
 public PermissionSvc(IPermissionRepo permissionRepo, IRolePermissionRepo rolePermissionRepo, IUserRoleRepo userRoleRepo)
 {
     _permissionRepo     = permissionRepo;
     _rolePermissionRepo = rolePermissionRepo;
     _userRoleRepo       = userRoleRepo;
 }