Пример #1
0
        private void FillTags(IBlogPostCommand command)
        {
            var query = new BlogQuery();
            var tags  = _blogQueryService.GetAllBlogTags(query);

            command.BlogTags = tags.ToCommand();
        }
Пример #2
0
        private void AddBlogTag(IBlogPostCommand command, BlogPost post)
        {
            if (command.BlogTags == null)
            {
                return;
            }

            foreach (var item in command.BlogTags.Where(c => c.Name != null))
            {
                var tag = new BlogTag
                {
                    Name         = item.Name,
                    CreationDate = DateTime.Now,
                    Creator      = "sdf",
                };

                if (item.IsNew)
                {
                    post.AddTag(tag);
                    // post.BlogTags.ForEach(c => c.BlogTags.Add(tag));
                }
                else
                {
                    var productTag = _blogRepository.GetBlogTagByValue(item.Name);
                    post.BlogTags.Add(productTag);
                }
            }
        }
Пример #3
0
        private void FillCategories(IBlogPostCommand command)
        {
            var query      = new BlogQuery();
            var categories = _blogQueryService.GetAllBlogCategories(query);

            ViewBag["BlogCategories"] = categories.ToCommand();
        }
Пример #4
0
 private void AddBlogAppurtenance(IBlogPostCommand command, BlogPost post)
 {
     AddBlogPost(command, post);
     AddBlogCategory(command, post);
     AddBlogTag(command, post);
     AddBlogPicture(command, post);
 }
Пример #5
0
 private void AddBlogCategory(IBlogPostCommand command, BlogPost post)
 {
     if (command.BlogCategory.Name == null)
     {
         return;
     }
     post.Category = command.BlogCategory.Name;
 }
Пример #6
0
 private static void AddBlogPicture(IBlogPostCommand command, BlogPost blogPost)
 {
     foreach (var postPicture in command.BlogPictures.Select(item => new BlogPicture
     {
         Name = item.Name,
         Address = item.Address,
         CreationDate = DateTime.Now,
         LastUpdateDate = DateTime.Now,
     }))
     {
         blogPost.AddPicture(postPicture);
     }
 }
Пример #7
0
 private void FillControlls(IBlogPostCommand command)
 {
     FillCategories(command);
     FillTags(command);
 }
Пример #8
0
 private static void AddBlogPost(IBlogPostCommand command, BlogPost post)
 {
     post.Title   = command.Title;
     post.Body    = command.Body;
     post.UrlSlug = command.Title.GenerateSlug();
 }