Ejemplo n.º 1
0
        private static IPost SetupPostAfterLoad(Post post, bool forEdit = false)
        {
            if (post == null)
                return null;

            post.CreatedByUser = AppCache.AuthorsAndAdmins[post.CreatedByUserId];
            post.ModifiedByUser = AppCache.AuthorsAndAdmins[post.ModifiedByUserId];

            if (forEdit)
                post.Tags = GetTagsFromCsv(post).ToList();
            else
                post.Tags = GetTagsFromCsv(post).ToArray();

            //Series object is setup by multi-poco mechanism of PetaPoco

            return post;
        }
Ejemplo n.º 2
0
 private static IEnumerable<ITag> GetTagsFromCsv(Post post)
 {
     return (post.TagIdCsv ?? string.Empty)
         .Split(Utils.CommaDelimiter)
         .Select(t => AppCache.Tags[int.Parse(t, CultureInfo.InvariantCulture)]);
 }