public LoginHandler(
     IPwmDbContextFactory factory,
     ILogin login,
     INewUserService newUserService)
 {
     this.login          = login;
     this.newUserService = newUserService;
     this.db             = factory.Create();
 }
        public UserManagementView(
            IPwmDbContextFactory factory,
            INewUserService newUserService)
        {
            InitializeComponent();

            Owner       = Application.Current.MainWindow;
            DataContext = new UserManagementViewModel(factory, newUserService);
        }
        protected DatabaseSetup()
        {
            var contextOptions = new DbContextOptionsBuilder <Context>();

            contextOptions.UseInMemoryDatabase("PWMTESTDATABASE");
            dbContextOptions = contextOptions.Options;

            IPwmDbContext db = new PwmDbContext(new Context(dbContextOptions));

            var dbContextFactoryMock = new Mock <IPwmDbContextFactory>();

            dbContextFactoryMock
            .Setup(x => x.Create())
            .Returns(db);

            dbContextFactory = dbContextFactoryMock.Object;
        }
        public UserManagementViewModel(
            IPwmDbContextFactory factory,
            INewUserService newUserService)
        {
            this.newUserService = newUserService;
            db = factory.Create();

            var users = new List <User>();

            foreach (USERDATA userdata in this.db.USERDATA)
            {
                users.Add(new User()
                {
                    UserName = Encryption.DecryptString(userdata.USUSERNAME),
                    FullName = Encryption.DecryptString(userdata.USNAME),
                });
            }

            User = new ObservableCollection <User>(users);

            AddNewUserCommand = new AsyncCommand(AddNewUser);
        }
 public DatabaseLogin(
     IPwmDbContextFactory dbContextFactory)
 {
     this.db = dbContextFactory.Create();
 }
Esempio n. 6
0
 public DatabaseDataManager(IPwmDbContextFactory dbDbContext, IUserInfo userInfo)
 {
     this.userInfo = userInfo;
     db            = dbDbContext.Create();
 }