Ejemplo n.º 1
0
        /// <summary>
        /// Creates a search result item from a Taxon object.
        /// </summary>
        /// <param name="taxon">The taxon.</param>
        /// <returns></returns>
        public static TaxonSearchResultItemViewModel CreateFromTaxon(ITaxon taxon)
        {
            var model = new TaxonSearchResultItemViewModel();

            model.NameCategory    = "TaxonId";
            model.Author          = taxon.Author.IsNotEmpty() ? taxon.Author : "";
            model.TaxonId         = taxon.Id;
            model.SearchMatchName = taxon.Id.ToString();
            model.ScientificName  = taxon.ScientificName.IsNotEmpty() ? taxon.ScientificName : "";
            model.CommonName      = taxon.CommonName.IsNotEmpty() ? taxon.CommonName : "";
            model.Category        = taxon.Category != null ? taxon.Category.Name : "";
            model.TaxonStatus     = (TaxonAlertStatusId)taxon.AlertStatus.Id;
            return(model);
        }
Ejemplo n.º 2
0
 protected bool Equals(TaxonSearchResultItemViewModel other)
 {
     return(TaxonId == other.TaxonId && string.Equals(ScientificName, other.ScientificName) && string.Equals(CommonName, other.CommonName) && string.Equals(SearchMatchName, other.SearchMatchName) && string.Equals(Category, other.Category) && string.Equals(Author, other.Author) && string.Equals(NameCategory, other.NameCategory) && TaxonStatus == other.TaxonStatus);
 }