Answer
$$y = x - 1 + C{e^{ - x}}$$
Work Step by Step
$$\eqalign{
& \frac{{dy}}{{dx}} + y = x \cr
& {\text{this equation is already written in the form }}\frac{{dy}}{{dx}} + P\left( x \right)y = Q\left( x \right) \cr
& {\text{comparing }}\frac{{dy}}{{dx}} + y = x{\text{ with }}\frac{{dy}}{{dx}} + P\left( x \right)y = Q\left( x \right){\text{ we can note that }}P\left( x \right){\text{ is 1 }} \cr
& {\text{The integrating factor is }}I\left( x \right) = {e^{\int {P\left( x \right)} dx}} \cr
& I\left( x \right) = {e^{\int {P\left( x \right)} dx}} = {e^{\int {dx} }} = {e^x} \cr
& {\text{multiplying both sides of the differential equation by }}{e^x} \cr
& {e^x}\frac{{dy}}{{dx}} + y{e^x} = x{e^x} \cr
& {\text{Write the terms on the left in the form }}{D_x}\left[ {I\left( x \right)y} \right] \cr
& {D_x}\left[ {{e^x}y} \right] = x{e^x} \cr
& {\text{solve for }}y{\text{ integrating both sides}} \cr
& {e^x}y = \int {x{e^x}} dx\,\,\,\,\,\left( {\bf{1}} \right) \cr
& \cr
& {\text{integrating }}\int {x{e^x}} dx{\text{ by parts}}{\text{,}}\,\,\,{\text{set }}u = x,\,\,\,\,du = dx,\,\,\,\,\,\,\,dv = {e^x},\,\,\,\,\,\,\,v = {e^x}{\text{. then}} \cr
& \,\,\,\,\,\,\,\int {x{e^x}} dx = x{e^x} - \int {{e^x}dx} \cr
& \,\,\,\,\,\,\,\int {x{e^x}} dx = x{e^x} - {e^x} + C \cr
& {\text{substituting the result of }}\int {x{e^x}} dx{\text{ in }}\left( {\bf{1}} \right) \cr
& {e^x}y = x{e^x} - {e^x} + C \cr
& y = x - 1 + \frac{C}{{{e^x}}} \cr
& {\text{or}} \cr
& y = x - 1 + C{e^{ - x}} \cr} $$