예제 #1
0
파일: Blogs.cs 프로젝트: MrZh/Wan.Blog
        public static void UpdateBlog(Blogs blog, List <string> categoryList)
        {
            var command = Command <Blogs> .InitBaseCommand(blog, CommandEnum.Update);

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

            commands.Insert(0, command);
            list = categoryList.Select(category => new BlogCategory {
                Id = Guid.NewGuid().ToString(), BlogId = blog.Id, CategoryId = category
            }).ToList();
            commands.AddRange(Command <BlogCategory> .InitBaseCommands(list));
        }
예제 #2
0
파일: Blogs.cs 프로젝트: MrZh/Wan.Blog
        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);
        }
예제 #3
0
파일: Blogs.cs 프로젝트: MrZh/Wan.Blog
        public static void TestString(Blogs blog)
        {
            var command = Command <Blogs> .InitBaseCommand(blog, CommandEnum.RelDelete);

            Command <Blogs> c = new Command <Blogs>(blog, true, CommandEnum.RelUpdate);
        }