예제 #1
0
 public static void Delete(Account account)
 {
     using (AuguryEntities ctx = new AuguryEntities()) {
         ctx.Accounts.Remove(account);
         ctx.SaveChanges();
     }
 }
예제 #2
0
        public static void Create(Account account)
        {
            account.Password = PasswordHelper.EncryptedPassword(account.Password);

            using (AuguryEntities ctx = new AuguryEntities()) {
                ctx.Accounts.Add(account);
                ctx.SaveChanges();
            }
        }
예제 #3
0
        public void PasswordEncryption()
        {
            string salt = ConfigurationManager.AppSettings["SaltString"];

            var account = new Account() { Username = "******", Password = "******" };
            account.Password = HashAndSalt.Encrypt(account.Password, salt);

            bool decrypted = HashAndSalt.CompareString("toto", account.Password, salt);
            Assert.IsTrue(decrypted);
        }
예제 #4
0
        public static void Update(Account account)
        {
            using (AuguryEntities ctx = new AuguryEntities()) {
                Account a = ctx.Accounts.Single(x => x.Username == account.Username);

                account.Password = PasswordHelper.EncryptedPassword(account.Password);

                a.Password = account.Password;
                ctx.SaveChanges();
            }
        }
예제 #5
0
        public void UpdateAccount()
        {
            var account = new Account() { Username = "******", Password = HashAndSalt.Encrypt("tata", ConfigurationManager.AppSettings["SaltString"]) };

            AccountManager.Update(account);
        }