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)); }
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); }
public static void TestString(Blogs blog) { var command = Command <Blogs> .InitBaseCommand(blog, CommandEnum.RelDelete); Command <Blogs> c = new Command <Blogs>(blog, true, CommandEnum.RelUpdate); }