Is it true that $\frac{dL}{dq}=1/\frac{\partial q}{\partial L}$? Marginal costs MC is defined as $MC=\frac{dC}{dq}$. Taking into account that $C=wL+rK$,

$$MC=\frac{dC}{dq}=w\frac{dL}{dq}+r\frac{dK}{dq}$$

Recall that marginal product of labor $MP_{L}=\frac{\partial q}{\partial L}$ and marginal product of capital $MP_{K}=\frac{\partial q}{\partial K}$.

Question: is the following correct 

$$\frac{dL}{dq}=1/\frac{\partial q}{\partial L},\;\frac{dK}{dq}=1/\frac{\partial q}{\partial K}$$

which implies

$$MC=w\frac{1}{MP_{L}}+r\frac{1}{MP_{K}}$$

If no, then no need to read further.

If yes, then, consider profit maximization of a firm.

$$\max_{L,K}pq\left(L,K\right)-wL-rK$$

FOC:

$$\begin{cases}pMP_{L}=w\\pMP_{K}=r\end{cases}\Rightarrow\begin{cases}MP_{L}=\frac{w}{p}\\MP_{K}=\frac{r}{p}\end{cases}$$

Therefore,

$$MC=w\frac{1}{MP_{L}}+r\frac{1}{MP_{K}}=w\frac{1}{w/p}+r\frac{1}{r/p}=p+p=2p$$

The result is wrong for sure. I wonder, at what step of derivation I made a mistake?
Question: is the following correct ?
  
  $$\frac{dL}{dq}=1/\frac{\partial q}{\partial L},\;\frac{dK}{dq}=1/\frac{\partial q}{\partial K}$$


In general, no. Since $q= f(L,K)$ is a multivariable, single-valued function, then by the implicit function theorem applied on the implied equation $H = f(L,K)-q=0$, what we can say is only that

$$\frac {\partial L}{\partial q} = -\frac {\partial H/\partial q}{\partial H /\partial L} = -\frac {-1}{MP_L} = \frac {1}{\partial q /\partial L}$$

Essentially, here we treat $q$ as a univariate function (by taking partial derivatives, we keep all other variables fixed).

But total derivatives are another matter.
For $q = f(L,K)$, we have the implicit relation $L = L(q,K)$ and so by taking the total differential and divide throughout by $dq$ we get

$$\frac {d L(q,K)}{d q} = \frac {\partial L(q,K)}{\partial q} + \frac {\partial L(q,K)}{\partial K}\frac {dK}{dq}$$

But $\frac {\partial L}{\partial K} \neq 0$, because we implicitly keep $q$ constant in order to calculate this partial derivative, and so by changing $K$ we have also to change $L$. The other possibility would be that $dK/dq$ is zero. If we do not have such a production function (or we are not in a range where such a thing holds), we obtain 

$$\frac {dL}{dq} \neq  \frac {\partial L}{\partial q} =  \frac {1}{\partial q/\partial L}$$