Guest User

Untitled

a guest
Jul 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. // Option 1 (with await)
  2. public async Task<AccountEntity> InsertAsync(AccountEntity item)
  3. {
  4. using (var connection = _connectionFactory.GetConnection())
  5. {
  6. connection.Open();
  7.  
  8. var sql = @"
  9. INSERT INTO Account (UserName, Password)
  10. OUTPUT INSERTED.*
  11. VALUES (@UserName, @Password);";
  12.  
  13. return await connection.QuerySingleAsync<AccountEntity>(sql, new { item.UserName, item.Password, });
  14. }
  15. }
Add Comment
Please, Sign In to add comment