Beispiel #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);
        }
Beispiel #2
0
        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));
        }