public bool CreateLoginOAuth(customer_login_oauth customerLoginOauth) { var repo = Repo.Instance; using (var db = repo.OpenConnectionFromPool()) { var result = repo.GetCustomerLoginOauth(db, customerLoginOauth.service.ToLower(), customerLoginOauth.identity).Data; if (result != null) return false; return repo.CreateCustomerLoginOAuth(db, customerLoginOauth) > 0; } }
public int CreateCustomerLoginOAuth(IDbConnection db, customer_login_oauth customerLoginOauth) { string sql = @"INSERT INTO customer_login_oauth (service, identity, customer_account_id) VALUES (@service, @identity, @customer_account_id) RETURNING id"; return db.Query<int>(sql, customerLoginOauth).FirstOrDefault(); }