Particular solution for $y'' + y' - 2y = 3xe^x$ For the equation $y'' + y' - 2y = 3xe^x.$

the auxiliary equation $\lambda^2+\lambda-2 = 0$ and $\lambda_1= 1$ and $\lambda_2 =-2$

so generic solution is $$C_1e^x+C_2e^{-2x}$$

am I right that particular solution will be:

$$x(Ax+B)e^x \rightarrow (Ax^2+Bx)e^x$$

After opening the brackets I got $Ax^2$ but my book has another answer, so I am a bit confused about how to act in this cases
First your generic solution (which you should call the homogeneous solution) is correct.To find the particular solution you should use the method of undetermined coefficients next.The complete solution is $y=y_h+y_p$. Where $y_h$ is the homogeneous solution and $y_p$ is the particular solution.  

Your guess for the particular solution should be of the form $$A x e^x + Bx^2 e^x  $$ where $A$ and $B$ are constants to be determined (That is your guess is correct). You now need to find
\begin{align}
\frac{d}{d x}A x e^x + Bx^2 e^x \\
\frac{d}{d x^2}A x e^x + Bx^2 e^x \\
\end{align}
and make the appropriate substitutions. After simplifying you should get $$(3 A+2B) e^x+6Be^x x=3 e^x x. $$
From which you can determine A and B.
make for the particular solution the ansatz $$y_P=(Ax^2+Bx+C)\exp(x)$$
i think your idea is good
for your Control the solution is given by $$y(x) ={{\rm e}^{x}}{\it \_C2}+{{\rm e}^{-2\,x}}{\it \_C1
}+1/6\, \left( 3\,x-2 \right) x{{\rm e}^{x}}
$$