Answer
$y=\dfrac{e^x}{e^x-xe^x+c}$
Work Step by Step
Here, we have $y'-y=xy^2$
Compare the above equation with the Bernoulli equation with $n=2$
Plug $u=y^{1-2}=y^{-1}$ or, $y=u^{-1}$
Then $\dfrac{du}{dx}=(-1)y^{-2}\dfrac{dy}{dx}$
or, $\dfrac{du}{dx}+\dfrac{1}{y}=-x$
or, $\dfrac{du}{dx}+u=x$
The integrating factor is: $e^{\int (1)dx}=e^{x}$
In order to determine the general solution, multiply equation (1) with the integrating factor and integrate both sides.
$\int [ue^x]'=\int xe^x dx $
or, $-ue^x=e^{x}(x-1)+c$
Thus, $y=\dfrac{e^x}{e^x-xe^x+c}$