diff --git a/source/DasBlog.Web.Repositories/BlogManager.cs b/source/DasBlog.Web.Repositories/BlogManager.cs index 7603b58e..b6a68969 100644 --- a/source/DasBlog.Web.Repositories/BlogManager.cs +++ b/source/DasBlog.Web.Repositories/BlogManager.cs @@ -42,11 +42,11 @@ public BlogManager( ILogger logger, IDasBlogSettings dasBlogSetting /// if non-null then the post must be dated on that date public Entry GetBlogPost(string posttitle, DateTime? dt) { - posttitle = posttitle.Replace(dasBlogSettings.SiteConfiguration.TitlePermalinkSpaceReplacement,string.Empty) - .Replace(".aspx", string.Empty); - if (dt == null) { + posttitle = posttitle.Replace(dasBlogSettings.SiteConfiguration.TitlePermalinkSpaceReplacement, string.Empty) + .Replace(".aspx", string.Empty); + return dataService.GetEntry(posttitle); } else @@ -54,7 +54,7 @@ public Entry GetBlogPost(string posttitle, DateTime? dt) var entries = dataService.GetEntriesForDay(dt.Value, null, null, 1, 10, null); return entries.FirstOrDefault(e => dasBlogSettings.GeneratePostUrl(e) - .Replace(dasBlogSettings.SiteConfiguration.TitlePermalinkSpaceReplacement, string.Empty) == posttitle); + .EndsWith(posttitle, StringComparison.OrdinalIgnoreCase)); } } diff --git a/source/DasBlog.Web.UI/Mappers/ProfilePost.cs b/source/DasBlog.Web.UI/Mappers/ProfilePost.cs index f90d084f..535182eb 100644 --- a/source/DasBlog.Web.UI/Mappers/ProfilePost.cs +++ b/source/DasBlog.Web.UI/Mappers/ProfilePost.cs @@ -77,8 +77,9 @@ public ProfilePost(IDasBlogSettings dasBlogSettings) CreateMap() .ForMember(dest => dest.BlogTitle, opt => opt.MapFrom(src => src.Title)) - .ForMember(dest => dest.BlogId, opt => opt.MapFrom(src => src.EntryId)); - + .ForMember(dest => dest.BlogId, opt => opt.MapFrom(src => _dasBlogSettings.GeneratePostUrl(src))) + .ForMember(dest => dest.Category, opt => opt.MapFrom(src => src.GetSplitCategories().FirstOrDefault())) + .ForMember(dest => dest.Date, opt => opt.MapFrom(src => src.CreatedLocalTime)); CreateMap() .ForMember(dest => dest.Allowed, opt => opt.MapFrom(src => src.Allowed))