private ITaxonClassification MapAphiaRecordToTaxonClassification(AphiaRecord record) { var result = new TaxonClassificationServiceModel { Rank = record.rank.MapTaxonRankStringToTaxonRankType(), ScientificName = record.scientificname, Authority = record.authority, CanonicalName = record.valid_name }; result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Kingdom, ScientificName = record.kingdom }); result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Phylum, ScientificName = record.phylum }); result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Class, ScientificName = record.@class }); result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Order, ScientificName = record.order }); result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Family, ScientificName = record.family }); result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Genus, ScientificName = record.genus }); return(result); }
private ITaxonClassification MapGbifTaxonToTaxonClassification(IGbifTaxon taxon) { var result = new TaxonClassificationServiceModel { ScientificName = taxon.ScientificName, CanonicalName = taxon.CanonicalName, Rank = taxon.Rank.MapTaxonRankStringToTaxonRankType() }; result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Kingdom, ScientificName = taxon.Kingdom }); result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Phylum, ScientificName = taxon.Phylum }); result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Class, ScientificName = taxon.Class }); result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Order, ScientificName = taxon.Order }); result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Family, ScientificName = taxon.Family }); result.Classification.Add(new TaxonRankServiceModel { Rank = TaxonRankType.Genus, ScientificName = taxon.Genus }); return(result); }
private ITaxonClassification MapResultToClassification(Result result) { var taxonClassification = new TaxonClassificationServiceModel { ScientificName = result.Name, Rank = result.Rank.MapTaxonRankStringToTaxonRankType(), Authority = result.Author, CanonicalName = result.AcceptedName?.Name }; foreach (var rank in Enum.GetValues(typeof(TaxonRankType)).Cast <TaxonRankType>()) { var taxon = this.GetClassificationItem(result, rank); if (taxon != null) { taxonClassification.Classification.Add(taxon); } } return(taxonClassification); }