private void UpdateExsistingLinearCalculationMethod(LinearCalMethodViewModel item, TRACK_COMPART_WORN_LIMIT_LIEBHERR linear) { linear.impact_intercept = item.Impact_Intercept == null ? 0 : item.Impact_Intercept; linear.impact_slope = item.Impact_Slope == null ? 0 : item.Impact_Slope; linear.normal_intercept = item.Normal_Intercept == null ? 0 : item.Normal_Intercept; linear.normal_slope = item.Normal_Slope == null ? 0 : item.Normal_Slope; _context.Entry(linear).State = EntityState.Modified; }
private void InsertNewLinearCalMethod(LinearCalMethodViewModel item) { var newLinear = new TRACK_COMPART_WORN_LIMIT_LIEBHERR { compartid_auto = item.CompartId, MeasurePointId = item.MeasurementPointId, track_tools_auto = item.ToolId, track_compart_worn_limit_liebherr_auto = item.WornCalculationMethodTypeId, impact_intercept = item.Impact_Intercept == null ? 0 : item.Impact_Intercept, impact_slope = item.Impact_Slope == null ? 0 : item.Impact_Slope, normal_intercept = item.Normal_Intercept == null ? 0 : item.Normal_Intercept, normal_slope = item.Normal_Slope == null ? 0 : item.Normal_Slope, }; _context.TRACK_COMPART_WORN_LIMIT_LIEBHERR.Add(newLinear); }
private void UpdateLinearCalculationMethod(LinearCalMethodViewModel item) { var checker = CheckEXTRecordExsistence(item.CompartId, item.ToolId, item.MeasurementPointId.Value); if (checker != null) { checker.track_compart_worn_calc_method_auto = item.WornCalculationMethodTypeId; _context.Entry(checker).State = EntityState.Modified; var linear = _context.TRACK_COMPART_WORN_LIMIT_LIEBHERR.FirstOrDefault(t => t.track_compart_worn_limit_liebherr_auto == item.WornCalculationMethodTableAutoId); if (linear == null) { InsertNewLinearCalMethod(item); } else { UpdateExsistingLinearCalculationMethod(item, linear); } } else { InsertNewTRACKCOMPARTExtRecord(item); InsertNewLinearCalMethod(item); } }