/// <summary>
        /// Method to interact with tables in Cosmos DB
        /// </summary>
        /// <param name="time">Time when price received</param>
        /// <param name="id">Currency type</param>
        /// <param name="price_eur">Price in Euro of the currency</param>
        /// <param name="hash">Hash of time, id and price_eur</param>
        public static void TableInsert(string time, string id, string price_eur, string hash)
        {
            string connectionString            = "DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=xxx;TableEndpoint=https://xxx.documents.azure.com:443/";
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
            CloudTableClient    tableClient    = storageAccount.CreateCloudTableClient();

            TableInteraction tableInteractionInstance = new TableInteraction();

            Console.WriteLine("Creating Table if it doesn't exist...");

            CloudTable table = tableClient.GetTableReference("xxx");

            table.CreateIfNotExists();

            tableObject item = new tableObject()
            {
                PartitionKey = Guid.NewGuid().ToString(),
                RowKey       = Guid.NewGuid().ToString(),
                Time         = time.ToString(),
                Currency     = id,
                Price        = price_eur,
                Hash         = hash
            };

            TableOperation insertOperation = TableOperation.Insert(item);

            table.Execute(insertOperation);
            Console.WriteLine("{0} > Write operation", time);
        }
        public ActionResult Create(List <tableObject> newObjects)
        {
            int floorplanID = 0;

            try {
                floorplanID = db.Floorplan.OrderByDescending(t => t.id).FirstOrDefault().id;
            }
            catch (NullReferenceException e)
            {
                floorplanID = 1;
            }
            for (int i = 0; i < newObjects.Count; i++)
            {
                newObjects[i].floorplanID = floorplanID;
            }

            var model = new tableObject();

            if (ModelState.IsValid)
            {
                newObjects.ForEach(r => db.tableObject.Add(r));
                //db.tableObjects.Add(newObjects);
                db.SaveChanges();
                return(Json(new { success = true }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            tableObject tableObject = db.tableObject.Find(id);

            db.tableObject.Remove(tableObject);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,xcoord,ycoord,objType,available,floorplanID")] tableObject tableObject)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tableObject).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tableObject));
 }
        // GET: tableObjects/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tableObject tableObject = db.tableObject.Find(id);

            if (tableObject == null)
            {
                return(HttpNotFound());
            }
            return(View(tableObject));
        }