public static CreateSlug ( string title ) : string | ||
title | string | |
return | string |
bool IMetaWeblog.UpdatePost(string postid, string username, string password, Post post, bool publish) { ValidateUser(username, password); Post match = Storage.GetAllPosts().FirstOrDefault(p => p.ID == postid); if (match != null) { match.Title = post.Title; match.Excerpt = post.Excerpt; match.Content = post.Content; if (!string.Equals(match.Slug, post.Slug, StringComparison.OrdinalIgnoreCase)) { match.Slug = PostHandler.CreateSlug(post.Slug); } match.Categories = post.Categories; match.IsPublished = publish; Storage.Save(match); } return(match != null); }
string IMetaWeblog.AddPost(string blogid, string username, string password, Post post, bool publish) { ValidateUser(username, password); post.Slug = PostHandler.CreateSlug(post.Title); post.IsPublished = publish; Storage.Save(post); return(post.ID); }
string IMetaWeblog.AddPost(string blogid, string username, string password, Post post, bool publish) { ValidateUser(username, password); if (!string.IsNullOrWhiteSpace(post.Slug)) { post.Slug = PostHandler.CreateSlug(post.Slug); } else { post.Slug = PostHandler.CreateSlug(post.Title); } // In case new post from WLW and pubdate is empty if (post.PubDate == DateTime.MinValue) { post.PubDate = DateTime.UtcNow; } post.IsPublished = publish; Storage.Save(post); return(post.ID); }