public static void Visit(string blogId, string userId) { var blogVisitor = new BlogVisitor { BlogId = blogId, UserId = userId, VisitTime = DateTime.Now }; BaseCommandBus.AsyncBaseSendCommand(Command <BlogVisitor> .InitBaseCommand(blogVisitor)); }
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); }
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 Delete(string visitorId) { BaseCommandBus.AsyncBaseSendCommand(Command <BlogVisitor> .InitBaseCommand(new BlogVisitor { Id = visitorId }, CommandEnum.Delete)); }
public static void Delete(string id) { BaseCommandBus.AsyncBaseSendCommand(Command <BlogContent> .InitBaseCommand(new BlogContent { Id = id }, CommandEnum.Delete)); }
public static void Publish(BlogContent blogContent) { BaseCommandBus.AsyncBaseSendCommand(Command <BlogContent> .InitBaseCommand(blogContent)); }
public static void Update(User user) { BaseCommandBus.AsyncBaseSendCommand(Command <User> .InitBaseCommand(user, CommandEnum.Update)); }
public static void Register(User user) { BaseCommandBus.AsyncBaseSendCommand(Command <User> .InitBaseCommand(user)); }