public async Task <Conductivity> AddOrUpdateConductivity(Conductivity conductivity) { var entity = await _context.Conductivities.AddAsync(conductivity); await _context.SaveChangesAsync(); return(entity.Entity); }
public ThirdLabCalculationObject(Conductivity conductivity, ElectricalPermeability electricalPermeability, WaveLength waveLength, Height transmitterHeight, Height receiverHeight, ThetaDegrees thetaDegrees, TraceLength traceLength, PolarizationType polarizationType) { this.conductivity = conductivity; this.electricalPermeability = electricalPermeability; this.waveLength = waveLength; this.transmitterHeight = transmitterHeight; this.receiverHeight = receiverHeight; this.thetaDegrees = thetaDegrees; this.traceLength = traceLength; this.PolarizationType = polarizationType; }
public async Task <IActionResult> AddOrUpdateConductivity(Conductivity conductivity) { try { var result = await _service.AddOrUpdateConductivity(conductivity).ConfigureAwait(false); return(Ok(result)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public override string Write() { var temp = "Material,\n"; temp += Name + ",\n"; temp += Roughness + ",\n"; temp += Thickness.ToString(CultureInfo.InvariantCulture) + ",\n"; temp += Conductivity.ToString(CultureInfo.InvariantCulture) + ",\n"; temp += Density.ToString(CultureInfo.InvariantCulture) + ",\n"; temp += SpecificHeat.ToString(CultureInfo.InvariantCulture) + ",\n"; temp += ThermalAbsorptance.ToString(CultureInfo.InvariantCulture) + ",\n"; temp += SolarAbsorptance.ToString(CultureInfo.InvariantCulture) + ",\n"; temp += VisibleAbsorptance.ToString(CultureInfo.InvariantCulture) + ";\n\n"; return(temp); }
public override object ReadJson(JsonReader reader, Type objectType, object?existingValue, JsonSerializer serializer) { var stringValue = (string)reader.Value !; return(Conductivity.Parse(stringValue, serializer.Culture)); }
/// <inheritdoc /> public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (!this.initialized) { this.Initialize(); } var message = this.errorText.ToString(); if (!(targetType == typeof(Conductivity) || targetType == typeof(Conductivity?))) { message += $"{this.GetType().Name} does not support converting to {targetType.Name}"; } if (message != string.Empty) { message = message.TrimEnd('\r', '\n'); if (Is.DesignMode) { throw new InvalidOperationException(message); } return(message); } if (value == null) { return(null); } if (value is double) { return(new Conductivity((double)value, this.unit.Value)); } var text = value as string; if (string.IsNullOrEmpty(text)) { return(null); } var unitInput = this.UnitInput ?? Wpf.UnitInput.ScalarOnly; switch (unitInput) { case Wpf.UnitInput.ScalarOnly: { double d; if (double.TryParse(text, NumberStyles.Float, culture, out d)) { return(new Conductivity(d, this.unit.Value)); } Conductivity result; if (Conductivity.TryParse(text, NumberStyles.Float, culture, out result)) { return($"#{text}#"); // returning modified text so that TypeConverter fails and we get an error } return(text); // returning raw to trigger error } case Wpf.UnitInput.SymbolAllowed: { double d; int pos = 0; WhiteSpaceReader.TryRead(text, ref pos); if (DoubleReader.TryRead(text, ref pos, NumberStyles.Float, culture, out d)) { WhiteSpaceReader.TryRead(text, ref pos); if (pos == text.Length) { return(new Conductivity(d, this.unit.Value)); } } goto case Wpf.UnitInput.SymbolRequired; } case Wpf.UnitInput.SymbolRequired: { Conductivity result; if (Conductivity.TryParse(text, NumberStyles.Float, culture, out result)) { return(result); } return(text); } default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Initializes a new instance of the <see cref="Gu.Units.Wpf.ConductivityExtension"/> class. /// </summary> /// <param name="value"><see cref="Gu.Units.Conductivity"/>.</param> public ConductivityExtension(Conductivity value) { this.Value = value; }