Exemplo n.º 1
0
        public static void DeleteBlog(string id)
        {
            var command = Command <Blogs> .InitBaseCommand(new Blogs { Id = id }, CommandEnum.Delete);

            var list = QueryContext.BaseGetListByParam <BlogCategory>(Query <BlogCategory> .InitQuery(new BlogCategory {
                BlogId = id
            }));
            var commands = Command <BlogCategory> .InitBaseCommands(list, CommandEnum.Delete);

            commands.Insert(0, command);
            BaseCommandBus.AsyncBaseSendCommands(commands);
        }
Exemplo n.º 2
0
        public static void PublishBlog(Blogs blog, List <string> categoryList = null)
        {
            var commands = new List <BaseCommand>();
            var command  = Command <Blogs> .InitBaseCommand(blog);

            if (categoryList != null)
            {
                var list = categoryList.Select(category => new BlogCategory {
                    Id = Guid.NewGuid().ToString(), BlogId = blog.Id, CategoryId = category
                }).ToList();
                commands.AddRange(Command <BlogCategory> .InitBaseCommands(list));
            }
            commands.Insert(0, command);
            BaseCommandBus.AsyncBaseSendCommands(commands);
        }