public bool Save()
        {
            try
            {
                string saveLocation = AppDomain.CurrentDomain.BaseDirectory + "RDCs.json";

                IEnumerable <RDCModel> rdcs = _rdcs.Select(x => new RDCModel()
                {
                    DisplayName   = x.DisplayName,
                    MachineName   = x.MachineName,
                    Username      = x.Username,
                    Password      = _encryptionManager.AesEncrypt(x.Password),
                    Domain        = x.Domain,
                    UserAccountId = x.UserAccountId,
                    GroupId       = x.GroupId
                });

                _fileAccess.Write(saveLocation, rdcs);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #2
0
        public bool Save()
        {
            try
            {
                string saveLocation = AppDomain.CurrentDomain.BaseDirectory + "RDCAccounts.json";

                IEnumerable <UserAccount> encrypted = _userAccounts.Select(x => new UserAccount()
                {
                    Id       = x.Id,
                    Name     = x.Name,
                    Username = x.Username,
                    Password = _encryptionManager.AesEncrypt(x.Password),
                    Domain   = x.Domain
                });

                _fileAccess.Write(saveLocation, encrypted);

                return(true);
            }
            catch
            {
                return(false);
            }
        }