예제 #1
0
        public static BlogArticle CreateSingle()
        {
            var entity = new BlogArticle
                                  {
                                      ModificationDate = DateTime.UtcNow.AddMonths(-1),
                                      AuthorId = UserCreator.CreateSingle().Id,
                                  };

            entity.Title = string.Format(CultureInfo.InvariantCulture, "Title {0}", entity.Id);
            entity.Content = string.Format(CultureInfo.InvariantCulture, "Content {0}", entity.Id);

            return entity;
        }
예제 #2
0
        public BlogArticleDetailsModel MapToDetail(BlogArticle blogArticle, User author)
        {
            return new BlogArticleDetailsModel
                       {
                           Id = blogArticle.Id,
                           Title = blogArticle.Title,
                           Content = blogArticle.Content.Replace(Environment.NewLine, "<br />"),

                           CreationDate = blogArticle.CreationDate,
                           PublishDate = blogArticle.PublishDate,
                           ModificationDate = blogArticle.ModificationDate,

                           AuthorName = author.Login.LoginName,
                       };
        }
예제 #3
0
        public BlogArticle AddBlogArticle(BlogArticle blogArticle)
        {
            if (blogArticle == null) throw new ArgumentNullException("blogArticle");

            return _catalogsContainer.BandCatalog.Add(blogArticle);
        }
예제 #4
0
        public void RemoveBlogArticle(BlogArticle blogArticle)
        {
            if (blogArticle == null) throw new ArgumentNullException("blogArticle");

            _catalogsContainer.BandCatalog.Remove(blogArticle);
        }
예제 #5
0
        public BlogArticle UpdateBlogArticle(BlogArticle article)
        {
            if (article == null) throw new ArgumentNullException("article");

            return BandRepository.UpdateBlogArticle(article);
        }
예제 #6
0
        public void RemoveBlogArticle(BlogArticle article)
        {
            if (article == null) throw new ArgumentNullException("article");

            BandRepository.RemoveBlogArticle(article);
        }
예제 #7
0
 public UpdateBlogArticleModel MapToUpdate(BlogArticle entity)
 {
     return new UpdateBlogArticleModel
                {
                    Id = entity.Id,
                    Title = entity.Title,
                    Content = entity.Content,
                };
 }