public AccountDTO GetAccount(RestAccount getAccount) { string secretString = ConfigurationManager.AppSettings["secretString"]; getAccount.restUser = AESencryption.DecryptStringAES(getAccount.restUser, secretString); getAccount.restPassword = AESencryption.DecryptStringAES(getAccount.restPassword, secretString); if (Membership.ValidateUser(getAccount.restUser, getAccount.restPassword)) { AccountDTO newObj = (AccountDTO)getAccount; newObj.userName = AESencryption.DecryptStringAES(newObj.userName, secretString); return account_ctx.find(newObj.userName); } else return null; }
public string DeleteAccount(RestAccount deleteAccount) { string secretString = ConfigurationManager.AppSettings["secretString"]; deleteAccount.restUser = AESencryption.DecryptStringAES(deleteAccount.restUser, secretString); deleteAccount.restPassword = AESencryption.DecryptStringAES(deleteAccount.restPassword, secretString); if (Membership.ValidateUser(deleteAccount.restUser, deleteAccount.restPassword)) { AccountDTO newObj = (AccountDTO)deleteAccount; newObj.userName = AESencryption.DecryptStringAES(newObj.userName, secretString); newObj.password = AESencryption.DecryptStringAES(newObj.password, secretString); newObj.status = AESencryption.DecryptStringAES(newObj.status, secretString); newObj.accountType = AESencryption.DecryptStringAES(newObj.accountType, secretString); account_ctx.remove(newObj); return "OK"; } else return "Authentication Failed"; }
public List<AccountDTO> GetAllAccounts(RestAccount getAccount) { List<AccountDTO> accounts = new List<AccountDTO>(); string secretString = ConfigurationManager.AppSettings["secretString"]; getAccount.restUser = AESencryption.DecryptStringAES(getAccount.restUser, secretString); getAccount.restPassword = AESencryption.DecryptStringAES(getAccount.restPassword, secretString); if (Membership.ValidateUser(getAccount.restUser, getAccount.restPassword)) { accounts = account_ctx.findAll(); return accounts.ToList(); } else return accounts.ToList(); }