public void DeletePassword(PasswordItem _selectedPasswordItem)
 {
     using (SQLiteConnection context = new SQLiteConnection(_connectionString))
     {
         context.Delete(_selectedPasswordItem);
     }
 }
 public PasswordItemViewModel(PasswordItem passwordItem)
 {
     _id = passwordItem.Id;
     _accountName = passwordItem.AccountName;
     _userName = passwordItem.UserName;
     _password = passwordItem.Password;
 }
        public void SavePassword(PasswordItem password)
        {
            using (SQLiteConnection context = new SQLiteConnection(_connectionString))
            {
                var existingPassword = (from p in context.Table<PasswordItem>()
                                       where p.Id == password.Id
                                       select p).FirstOrDefault();

                if (existingPassword != null)
                {
                    context.Update(password);
                }
                else
                {
                    context.Insert(password);
                }
            }
        }
        private void Save()
        {
            PasswordItem password = new PasswordItem()
            {
                Id = this.Id,
                AccountName = this.AccountName,
                UserName = this.UserName,
                Password = CryptographyHelper.Encrypt(this.Password, CryptographyHelper.Key)
            };
            _passwordRepository.SavePassword(password);

            _navigationService.GoBack();
        }