//
        // GET: /MailingList/

        public ActionResult Index()
        {
            TableRequestOptions reqOptions = new TableRequestOptions()
            {
                MaximumExecutionTime = TimeSpan.FromSeconds(1.5),
                RetryPolicy = new LinearRetry(TimeSpan.FromSeconds(3), 3)
            };

            List<MailingList> lists;
            try
            {
                DataAccess dataLayer = new DataAccess();
                lists = dataLayer.RetrivesTables("RowKey");

            }
            catch (StorageException se)
            {
                ViewBag.errorMessage = "Timeout error, try again. ";
                Trace.TraceError(se.Message);
                return View("Error");
            }

            return View(lists);
        }
        public ActionResult CreateQueue(Subscriber subscriber)
        {
            if (ModelState.IsValid)
            {
                DataAccess dataLayer = new DataAccess();
                dataLayer.SaveQueue(subscriber.ListName);
                return RedirectToAction("Index");
            }

            return View(subscriber);
        }
        public ActionResult CreateBlob(string test123, HttpPostedFileBase test, HttpPostedFileBase file)
        {
            DataAccess data = new DataAccess();
            data.SaveBlob(DateTime.Now.ToString() + ".txt", file);

            return RedirectToAction("CreateBlob");
        }
        public ActionResult Create(MailingList mailingList)
        {
            if (ModelState.IsValid)
            {
                using (MD5CryptoServiceExample md5CryptoService = new MD5CryptoServiceExample())
                {
                    MailingList encrptionMail = new MailingList()
                    {
                        Description = md5CryptoService.Encrypt(mailingList.Description, false),
                        FromEmailAddress = md5CryptoService.Encrypt(mailingList.FromEmailAddress, false),
                        ListName = mailingList.ListName,
                    };

                    DataAccess dataLayer = new DataAccess();
                    dataLayer.SaveTable(encrptionMail);
                }                

                return RedirectToAction("Index");

            }

            return View(mailingList);
        }