public FullSubstanceModel GetById(int id) { var item = _substances.GetById(id); var result = new FullSubstanceModel { BoilingPoint = item.BoilingPoint, Categories = GetCategoryList(item.Categories).OrderBy(c => c.Id).Select(c => c.Name).Distinct().ToArray(), Density = item.Density, Elements = ParseFormula(item.Formula), FlashPoint = item.FlashPoint, Formula = item.Formula, HazardSymbols = item.HazardSymbols, MeltingPoint = item.MeltingPoint, Names = item.Names.Select(x => x.Value).ToArray(), RefractiveIndex = item.RefractiveIndex, Schemes = item.Scheme.Select(x => x.Value.HtmlDecode()).ToArray(), VapourPressur = item.VapourPressur, WaterSolubility = WaterBoolToStr(item.WaterSolubility) }; return(result); }
public IFullSubstanceModel GetById(int id) { var result = new FullSubstanceModel(); var item = _substances.GetById(id); if (item == null) { return(null); } if (item.BoilingPoint != null) { result.BoilingPoint = item.BoilingPoint; } if (item.Categories != null) { result.Categories = GetCategoryList(item.Categories).OrderBy(c => c.Id).Select(c => c.Name).Distinct().ToArray(); } if (item.Density != null) { result.Density = item.Density; } if (item.Formula != null) { result.Elements = ParseFormula(item.Formula); } if (item.FlashPoint != null) { result.FlashPoint = item.FlashPoint; } if (item.Formula != null) { result.Formula = item.Formula; } if (item.HazardSymbols != null) { result.HazardSymbols = item.HazardSymbols; } if (item.MeltingPoint != null) { result.MeltingPoint = item.MeltingPoint; } if (item.Names != null) { result.Names = item.Names.Select(x => x.Value).ToArray(); } if (item.RefractiveIndex != null) { result.RefractiveIndex = item.RefractiveIndex; } if (item.Scheme != null) { result.Schemes = item.Scheme.Select(x => x.Value.HtmlDecode()).ToArray(); } if (item.VapourPressur != null) { result.VapourPressur = item.VapourPressur; } if (item.WaterSolubility != null) { result.WaterSolubility = WaterBoolToStr(item.WaterSolubility); } return(result); }