public ActionResult BarParameters(BarParametersView 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.BarHeight = model.BarHeight.Value; variant.InputData.BarLength = model.BarLength.Value; variant.InputData.BarNumber = model.BarNumber.Value; variant.InputData.BarThickness = model.BarThickness.Value; variant.InputData.EndBottomSteelTemperature = model.EndBottomSteelTemperature.Value; variant.InputData.EndTopSteelTemperature = model.EndTopSteelTemperature.Value; variant.InputData.StartSteelTemperature = model.StartSteelTemperature.Value; variant.InputData.SteelTypeForDensity = model.SteelTypeForDensity; variant.InputData.SteelTypeProperty = model.SteelTypeProperty; variant.InputData.TopSteelTemperatureSector1 = model.TopSteelTemperatureSector1.Value; variant.IsBarParametersExist = true; db.SaveChanges(); return(RedirectToAction("FurnanceParameters", new { id = model.Id })); } return(View(model)); }
public ActionResult BarParameters(Guid id) { var variant = db.Variants.Find(id); if (variant == null) { return(HttpNotFound()); } var model = new BarParametersView(); if (variant.IsBarParametersExist) { model.Id = Guid.NewGuid(); model.BarHeight = variant.InputData.BarHeight; model.BarLength = variant.InputData.BarLength; model.BarNumber = variant.InputData.BarNumber; model.BarThickness = variant.InputData.BarThickness; model.EndBottomSteelTemperature = variant.InputData.EndBottomSteelTemperature; model.EndTopSteelTemperature = variant.InputData.EndTopSteelTemperature; model.StartSteelTemperature = variant.InputData.StartSteelTemperature; model.SteelTypeForDensity = variant.InputData.SteelTypeForDensity; model.SteelTypeProperty = variant.InputData.SteelTypeProperty; model.TopSteelTemperatureSector1 = variant.InputData.TopSteelTemperatureSector1; } return(View(model)); }