我认为当您在运行时为空引用的lambda中使用变量时,会发生此令人困惑的异常。在您的情况下,我将检查您的变量CalculationViewModel是否为空引用。
就像是:
public ActionResult MNPurchase(){ CalculationViewModel calculationViewModel = (CalculationViewModel)TempData["calculationViewModel"]; if (calculationViewModel != null) { decimal OP = landTitleUnitOfWork.Sales.Find() .Where(x => x.Min >= calculationViewModel.SalesPrice) .FirstOrDefault() .OP; decimal MP = landTitleUnitOfWork.Sales.Find() .Where(x => x.Min >= calculationViewModel.MortgageAmount) .FirstOrDefault() .MP; calculationViewModel.LoanAmount = (OP + 100) - MP; calculationViewModel.LendersTitleInsurance = (calculationViewModel.LoanAmount + 850); return View(calculationViewModel); } else { // Do something else... }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)