private static AuthorMetadata MapAuthor(AuthorSummaryResource resource) { var author = new AuthorMetadata { ForeignAuthorId = resource.Id.ToString(), Name = resource.Name.CleanSpaces(), TitleSlug = resource.Id.ToString() }; if (resource.RatingsCount.HasValue) { author.Ratings = new Ratings { Votes = resource.RatingsCount ?? 0, Value = resource.AverageRating ?? 0 }; } if (!NoPhotoRegex.IsMatch(resource.ImageUrl)) { author.Images.Add(new MediaCover.MediaCover { Url = FullSizeImageRegex.Replace(resource.ImageUrl), CoverType = MediaCoverTypes.Poster }); } return(author); }
private static AuthorMetadata MapAuthor(AuthorSummaryResource resource) { var author = new AuthorMetadata { ForeignAuthorId = resource.Id.ToString(), Name = resource.Name.CleanSpaces(), TitleSlug = resource.Id.ToString() }; author.SortName = author.Name.ToLower(); author.NameLastFirst = author.Name.ToLastFirst(); author.SortNameLastFirst = author.NameLastFirst.ToLower(); if (resource.RatingsCount.HasValue) { author.Ratings = new Ratings { Votes = resource.RatingsCount ?? 0, Value = resource.AverageRating ?? 0 }; } return(author); }