public async Task Create(AccountModel account)
        {
            string sql = "select * from Account where EMAIL=@EMAIL OR USERNAME=@USERNAME;";

            var query = await _db.LoadData <AccountModel, dynamic>(sql, new { EMAIL = account.EMAIL, USERNAME = account.USERNAME });

            if (query.Count != 0)
            {
                throw new Exception();
                return;
            }


            account.PASSWORD = HashPassword(account.PASSWORD);
            string sqlCommand = @"INSERT INTO Account(EMAIL, USERNAME, NAME, SURNAME, PASSWORD)
                                          VALUES(@EMAIL, @USERNAME, @NAME, @SURNAME, @PASSWORD);";
            await _db.SaveData(sqlCommand, account);
        }
Example #2
0
 public async Task Delete(int id)
 {
     string sqlCommand = "DELETE FROM Wish WHERE WISH_ID=@WISH_ID";
     await _db.SaveData(sqlCommand, new { WISH_ID = id });
 }