public AdminController()
 {
     categoryService = new CategoryService();
     goodService = new GoodService();
     blobService = new BlobService();
     queueService = new QueueService();
 }
        static void Main(string[] args)
        {
            QueueService queueService;
            GoodService goodService;

            queueService = new QueueService();
            queueService.Initialize();

            goodService = new GoodService();
            goodService.Initialize();

            Console.WriteLine("Initialized");

            while (true)
            {
                var message = queueService.GetMessage();
                if (message == null)
                {
                    Console.WriteLine("sleep...");
                    Thread.Sleep(new TimeSpan(0, 0, 10));
                }
                else
                {
                    var good = goodService.GetById(message.AsString);
                    good.IsApproved = true;
                    goodService.InsertOrReplace(good);

                    queueService.DeleteMessage(message.Id, message.PopReceipt);

                    Console.WriteLine("processed {0}", good.Title);
                }

            }
        }
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            queueService = new QueueService();
            queueService.Initialize();

            goodService = new GoodService();
            goodService.Initialize();

            return base.OnStart();
        }
 public HomeController()
 {
     categoryService = new CategoryService();
     goodService = new GoodService();
     blobService = new BlobService();
 }