David McGoldrick scored twice as Ipswich beat Middlesbrough 3-1 at Portman Road to record their first Sky Bet Championship win in four matches.