// GET: /QRCode/
 public ActionResult Index()
 {
     PurchaseOrderRepository rep = new PurchaseOrderRepository();
     List<string> urls = rep.ListUnusedQRUrls(18);
     ViewBag.UnusedQRCodeCount = rep.GetUnusedQRCodeCount();
     return View(urls);
 }
        // GET: /QRCode/Build
        public ActionResult Build(int numToBuild)
        {
            PurchaseOrderRepository rep = new PurchaseOrderRepository();
            List<string> shortURLs = new List<string>();

            for (int i = 0; i < numToBuild; i++)
            {
                PurchaseOrder po = new PurchaseOrder();
                po = rep.Save(po);

                string buildURL = "http://qr.tbs.io/qr/build?entityid=14&poid=" + po.POId.ToString() + "&url=true";
                string buildResponse = CallURL(buildURL);
                string qrCodeShortURL = buildResponse.Substring(buildResponse.LastIndexOf('?') + 3);
                qrCodeShortURL = qrCodeShortURL.Remove(qrCodeShortURL.LastIndexOf('"'));
                po.QRCodeShortURL = qrCodeShortURL;

                po = rep.Save(po);
                shortURLs.Add(po.QRCodeShortURL);
            }

            return RedirectToAction("Index");
        }
 public ActionResult PrinterFriendlyIndex(int numPages)
 {
     PurchaseOrderRepository rep = new PurchaseOrderRepository();
     List<string> urls = rep.ListUnusedQRUrls(48 * numPages);
     return View(urls);
 }