Another way to do it with a test:
int MonthNumber = DateTime.Now.Month-1;
if (MonthNumber == 0)
MonthNumber = 12;
Another way to do it without test:
int MonthNumber = ((DateTime.Now.Month+10)%12)+1;
Principle
Months are from 1 (January) to 12 (December).
Previous month of January is December
There is a mathematical function called modulus, but it is zero based (from 0 to 11) and it don't like negative values.
Fortunately month-1 is the same as month+11