Inheritance: System.Entity
Ejemplo n.º 1
0
        private static SyndicationItem ConvertPostToSyndicationItem(Post post)
        {
            var item = new SyndicationItem();

            item.Id = item.Id;
            item.Title = new TextSyndicationContent(post.Title);
            item.Content = new TextSyndicationContent(post.Content);
            item.PublishDate = post.DateCreated;

            return item;
        }
Ejemplo n.º 2
0
        internal string NewPost(string blogId, string userName, string password, MWAPost sentPost, bool publish)
        {
            ValidateRequest(userName, password);

            var repository = Ioc.Resolve<IRepository>();

            var user = repository.Find<UserProfile>().GetBy(string.IsNullOrEmpty(sentPost.author) ? userName : sentPost.author);
            var post = new Post(user.Name, sentPost.title, sentPost.description, sentPost.excerpt, sentPost.slug, publish);

            foreach (string item in sentPost.categories.Where(x => x != null && x.Trim() != ""))
                post.Categories.Add(new Category(item.Trim(), ""));

            foreach (string item in sentPost.tags.Where(x => x != null && x.Trim() != ""))
                post.Tags.Add(item.Trim());

            if (sentPost.postDate != DateTime.MinValue)
                post.DateCreated = sentPost.postDate;

            repository.Save(post);

            return post.Id.ToString();
        }