public ConfigEntity GetConfigByKey(string key)
        {

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);

            // Create the table client.
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            // Create the CloudTable object that represents the "people" table.
            CloudTable table = tableClient.GetTableReference("config");

            // Create a retrieve operation that takes a customer entity.
            TableOperation retrieveOperation = TableOperation.Retrieve<ConfigEntity>(PARTITION_KEY, key);

            // Execute the retrieve operation.
            TableResult retrievedResult = table.Execute(retrieveOperation);
            ConfigEntity config = new ConfigEntity() { Value = "10" };
            if (retrievedResult.HttpStatusCode == 200)
            {
                config = (ConfigEntity)retrievedResult.Result;
            }


            return config;

        }
        public void SaveConfigValue(string key, int value)
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);

            // Create the table client.
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            // Create the CloudTable object that represents the "people" table.
            CloudTable table = tableClient.GetTableReference("config");

            // Create a new customer entity.
            var config = new ConfigEntity();
            config.PartitionKey = PARTITION_KEY;
            config.RowKey = key;
            config.Value = value.ToString();


            // Create the TableOperation object that inserts the customer entity.
            TableOperation insertOperation = TableOperation.InsertOrReplace(config);

            // Execute the insert operation.
            table.Execute(insertOperation);

        }
 public ActionResult Save(ConfigEntity config)
 {
     int newValue = Convert.ToInt32(config.Value);
     SaveConfigValue(config.RowKey, newValue);
     return View("Index", config);
 }
 public ActionResult Index(ConfigEntity config)
 {
     return Save(config);
 }