public ActionResult FuelParameters(FuelParametersView model) { if (ModelState.IsValid) { var variant = db.Variants.Find(model.Id); if (variant == null) { return(HttpNotFound()); } if (variant.InputData == null) { variant.InputData = new InputData(); } variant.InputData.Id = model.Id; variant.InputData.HeatBlast = model.HeatBlast.Value; variant.InputData.HeatFull = model.HeatFull.Value; variant.InputData.HeatNatural = model.HeatNatural.Value; variant.IsFuelParametersExist = true; if (variant.ResultData != null) { Session["old_result"] = ResultView.CopyFrom(variant.ResultData); } try { Calculate(variant); } catch (Exception exc) { ModelState.AddModelError("", "Не удалось выполнить расчет"); ModelState.AddModelError("", exc.Message); return(View(model)); } db.SaveChanges(); return(RedirectToAction("Results", new { id = model.Id, checkOldResults = true })); } return(View(model)); }