Calculation of magnetocaloric effect with regard for dependence of heat capacity on magnetic field