Пример #1
0
        public async Task <ActionResult> AddMessage()
        {
            var rnd      = new Random();
            var cartName = rnd.Next(0, 99999);

            var campaignCart = new CampaignCart()
            {
                Id = Guid.NewGuid().ToString("N"), Items = new List <MediaItem>()
            };

            var queueService = new CloudQueueService(AzureQueues.Command);

            for (var k = 0; k < 5; k++)
            {
                var type      = rnd.Next(0, 99999);
                var mediaItem = new MediaItem()
                {
                    Description = "Some random description number " + type,
                    Name        = "Random Name " + type,
                    Id          = Guid.NewGuid().ToString("N"),
                    Price       = type * type
                };
                campaignCart.Items.Add(mediaItem);
            }
            ICommand command = new CreateCampaignCartCommand(this.CurrentTenant.Name, campaignCart);
            await queueService.AddMessageAsync(command);

            return(this.RedirectToAction("Index"));
        }