private void FillTags(IBlogPostCommand command) { var query = new BlogQuery(); var tags = _blogQueryService.GetAllBlogTags(query); command.BlogTags = tags.ToCommand(); }
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); } } }
private void FillCategories(IBlogPostCommand command) { var query = new BlogQuery(); var categories = _blogQueryService.GetAllBlogCategories(query); ViewBag["BlogCategories"] = categories.ToCommand(); }
private void AddBlogAppurtenance(IBlogPostCommand command, BlogPost post) { AddBlogPost(command, post); AddBlogCategory(command, post); AddBlogTag(command, post); AddBlogPicture(command, post); }
private void AddBlogCategory(IBlogPostCommand command, BlogPost post) { if (command.BlogCategory.Name == null) { return; } post.Category = command.BlogCategory.Name; }
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); } }
private void FillControlls(IBlogPostCommand command) { FillCategories(command); FillTags(command); }
private static void AddBlogPost(IBlogPostCommand command, BlogPost post) { post.Title = command.Title; post.Body = command.Body; post.UrlSlug = command.Title.GenerateSlug(); }