public static Measurement_Type ConverttoEntity(MeasurementTypeModel inmeasurementtype) { Measurement_Type measurementtype = null; try { measurementtype = new Measurement_Type(); measurementtype.typeid = inmeasurementtype.typeid; measurementtype.maxvalue = inmeasurementtype.maxvalue; measurementtype.minvalue = inmeasurementtype.minvalue; measurementtype.description = inmeasurementtype.description; measurementtype.unit = inmeasurementtype.unit; log.Info("MeasurementTypeModel wurde konvertiert."); } catch (Exception exp) { log.Error("MeasurementTypeModel konnte nicht konvertiert werden."); throw new DalException("MeasurementTypeModel konnte nicht konvertiert werden.", exp); } return measurementtype; }
public static MeasurementTypeModel ConvertfromEntity(Measurement_Type inmeasurementtype) { MeasurementTypeModel measurementtype = null; try { measurementtype = new MeasurementTypeModel(); measurementtype.typeid = inmeasurementtype.typeid; measurementtype.maxvalue = inmeasurementtype.maxvalue; measurementtype.minvalue = inmeasurementtype.minvalue; measurementtype.description = inmeasurementtype.description; measurementtype.unit = inmeasurementtype.unit; foreach (var item in inmeasurementtype.Measurement) { measurementtype.Measurement.Add(item.measid); } log.Info("MeasurementType wurde konvertiert."); } catch (Exception exp) { log.Error("MeasurementType konnte nicht konvertiert werden."); throw new DalException("MeasurementType konnte nicht konvertiert werden.", exp); } return measurementtype; }