Yes, that's the correct method (and 0 is the correct answer).
One small remark though: $\displaystyle -7+7/1+2$ is not the correct the way to write your calculation. This calculation is solved as:
$\displaystyle -7+7/1+2=-7+7+2=2$
which I think is not what you meant.
The correct way of writing is with either brackets or fractions, like this:
$\displaystyle (-7+7)/(1+2)$ or $\displaystyle \frac{-7+7}{1+2}$
Another way: you want y= mx+ b and both (x, y)= (-2, -7) and (x, y)= (1, -7) must satisfy that equation. Putting those values into the equation, we have -7= m(-2)+ b and -7= m(-1)+ b so can solve the simultaneous equations -2m+ b= -7, -m+ b= -7.
Of course, the easiest way to solve this particular problem is to observe that both points have y-value -7. Since a straight line is determined by two points, that's a horizontal line and y= -7 must be the equation.