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); }
public Task <List <AccountModel> > GetAll() { string sql = "select * from Wish WHERE Wish.TIMESTAMP >= cast(dateadd(day, -3, getdate()) as date) Wish.GRANTED = 1;"; return(_db.LoadData <AccountModel, dynamic>(sql, new { })); }