// GET: AzureStorage
        public ActionResult Index(string Name)
        {
            if (TempData["DeleteSuccess"]!= null)
            {
                if (TempData["DeleteSuccess"].ToString() == "True")
                {
                    ViewBag.DeleteSuccess = true;
                }
                else
                {
                    ViewBag.Error = TempData["DeleteSuccess"].ToString();
                }
            }
            var Model = new AzureViewModel();
            Model.Name = Name;
            var azureFileStorageManager = new AzureFileStorageManager();
            azureFileStorageManager.ExtendedProperties["accountName"] = ConfigurationManager.AppSettings["AzureAccountName"];
            azureFileStorageManager.ExtendedProperties["accessKey"] = ConfigurationManager.AppSettings["AzureAccountKey"];

            if (!string.IsNullOrEmpty(Name))
            {
                try
                {
                    var download = azureFileStorageManager.DownloadToByteArray("devaccelerate", Name);
                    Model.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String((byte[])download);
                    ViewBag.Success = true;
                }
                catch (Exception ex)
                {
                    ViewBag.Error = ex.Message;
                }
            }

            return View(Model);
        }
        public ActionResult Delete(string Name)
        {
            var Model = new AzureViewModel();
            Model.Name = Name;
            var azureFileStorageManager = new AzureFileStorageManager();
            azureFileStorageManager.ExtendedProperties["accountName"] = ConfigurationManager.AppSettings["AzureAccountName"];
            azureFileStorageManager.ExtendedProperties["accessKey"] = ConfigurationManager.AppSettings["AzureAccountKey"];

            if (!string.IsNullOrEmpty(Name))
            {
                try
                {
                    azureFileStorageManager.Delete("devaccelerate", Name);
                    TempData["DeleteSuccess"] = "True";
                    return RedirectToAction("Index", "AzureStorage");
                }
                catch (Exception ex)
                {
                    TempData["DeleteSuccess"] = ex.Message;
                    return RedirectToAction("Index", "AzureStorage", new { Name = Name });
                }
            }
            TempData["DeleteSuccess"] = "Could not find the image";
            return RedirectToAction("Index", "AzureStorage", new { Name = Name });
        }
        public ActionResult Index(AzureViewModel Model)
        {
            if (HttpContext.Request.Files != null && HttpContext.Request.Files.Count > 0)
            {
                HttpPostedFileBase file = HttpContext.Request.Files[0];
                var oFile = new HttpFile()
                {
                    ContentLength = file.ContentLength,
                    ContentType = file.ContentType,
                    FileName = file.FileName,
                    Stream = file.InputStream
                };

                string fileExtension = System.IO.Path.GetExtension(file.FileName);
                if (fileExtension.ToLower() == ".jpeg" || fileExtension.ToLower() == ".png" || fileExtension.ToLower() == ".jpg")
                {
                    if (file.ContentLength < 5242880)
                    {
                        try
                        {
                            var azureFileStorageManager = new AzureFileStorageManager();
                            azureFileStorageManager.ExtendedProperties["accountName"] = ConfigurationManager.AppSettings["AzureAccountName"];
                            azureFileStorageManager.ExtendedProperties["accessKey"] = ConfigurationManager.AppSettings["AzureAccountKey"];

                            azureFileStorageManager.Upload("devaccelerate", oFile.FileName, oFile);

                            ViewBag.Success = "Image successfully uploaded";
                            return RedirectToAction("Index", "AzureStorage", new { Name = oFile.FileName });
                        }
                        catch (Exception ex)
                        {
                            ViewBag.Error = ex.Message;
                            return RedirectToAction("Index");
                        }
                    }

                    ViewBag.Error = "Upload a picture less than 5Mb";
                    return RedirectToAction("Index");
                }
                ViewBag.Error = "Picture format should be .jpg or png";
            }
            return RedirectToAction("Index");
        }