public ActionResult FurnanceParameters(FurnanceParametersView 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.FurnanceHeightZone1 = model.FurnanceHeightZone1.Value; variant.InputData.FurnanceProductivity = model.FurnanceProductivity.Value; variant.InputData.FurnanceWidth = model.FurnanceWidth.Value; variant.InputData.TorchType = model.TorchType; variant.InputData.WorkHeightSector0 = model.WorkHeightSector0.Value; variant.InputData.WorkHeightSector1 = model.WorkHeightSector1.Value; variant.InputData.WorkHeightSector2 = model.WorkHeightSector2.Value; variant.IsFurnanceParametersExist = true; db.SaveChanges(); return(RedirectToAction("EnvironmentParameters", new { id = model.Id })); } return(View(model)); }
public ActionResult FurnanceParameters(Guid id) { var variant = db.Variants.Find(id); if (variant == null) { return(HttpNotFound()); } var model = new FurnanceParametersView(); if (variant.IsFurnanceParametersExist) { model.Id = variant.InputData.Id; model.FurnanceHeightZone1 = variant.InputData.FurnanceHeightZone1; model.FurnanceProductivity = variant.InputData.FurnanceProductivity; model.FurnanceWidth = variant.InputData.FurnanceWidth; model.TorchType = variant.InputData.TorchType; model.WorkHeightSector0 = variant.InputData.WorkHeightSector0; model.WorkHeightSector1 = variant.InputData.WorkHeightSector1; model.WorkHeightSector2 = variant.InputData.WorkHeightSector2; } return(View(model)); }