public JsonResult Calculate(long memberId, long insuredId, bool ownPremiumPayer) { double premiumFee = -1; double policyFee = -1; double policyTotal = -1; Member m = memberModel.Read(memberId); if (m != null) { double insuredSum = enumInsuredSumModel.GetInsuredSum(insuredId); policyFee = enumPolicyFeeModel.PolicyFee(); premiumFee = PickPremium(m, insuredSum, ownPremiumPayer); policyTotal = premiumFee + policyFee; //log data to history table History history = new History() { Date = DateTime.Now, PolicyFee = policyFee, Premium = premiumFee, Insured = insuredSum, PremiumPayer = ownPremiumPayer, MemberId = memberId }; historyModel.Create(history); } return(Json(new double[] { policyFee, premiumFee, policyTotal }, JsonRequestBehavior.AllowGet)); }