public void PublishToProjection(CreateProductCommand createProductCommand)
 {
     Thread.Sleep(500);
     var product = new Product();
     product.Id = createProductCommand.ProductId;
     product.Name = createProductCommand.Name;
     ProductProjections.ProductRepo.Add(product.Id, product);
 }
        public AjaxContinuation Post(CreateProductCommand createProductCommand)
        {
            var commandHandler = new CQRS.CreateProductCommandHandler();
            createProductCommand.CommandId = Guid.NewGuid();
            createProductCommand.ProductId = new Random().Next(1000);

            commandHandler.Publish(createProductCommand);

            var continuation = AjaxContinuation.Successful();
            continuation.Message = "/Product/Details/?Id=" + createProductCommand.ProductId;
            return continuation;
        }
 public void Publish(CreateProductCommand createProductCommand)
 {
     EventRepo.Add(createProductCommand.CommandId, createProductCommand);
     ThreadPool.QueueUserWorkItem(x => PublishToProjection(createProductCommand));
 }