internal static AirQualityIndex FromApi(ApiAirQualityIndex index) => AirQualityIndex.Create(index.Name, index.Value, index.Level, index.Description, index.Advice, index.Color);
private AirQualityIndex Save(AirQualityIndex index, long measurementItemId) { if (_connection.Get.Insert(AirQualityIndexEntity.FromDomain(index, measurementItemId)) > 0) { return(index.WithId(_connection.LastIndex)); } return(null); }
public static AirQualityIndexEntity FromDomain(AirQualityIndex index, long measurementItemRef) => new AirQualityIndexEntity(index.Id, index.Name, index.Value, index.Level, index.Description, index.Advice, index.Color, measurementItemRef);
public virtual AirQualityIndex Format(HtmlNode node, string cityName, DateTime createTime) { if (node != null) { AirQualityIndex AQI = new AirQualityIndex(); AQI.City = cityName; AQI.Monitor = node.ChildNodes[0].InnerText; AQI.AQI = node.ChildNodes[1].InnerText; AQI.Quality = string.Concat(this.baseUrl, node.ChildNodes[2].ChildNodes[0].Attributes[0].Value.Replace("../", string.Empty)); AQI.PM25 = node.ChildNodes[3].InnerText; AQI.PM10 = node.ChildNodes[4].InnerText; AQI.CreateTime = createTime; return(AQI); } return(default(AirQualityIndex)); }