public Dictionary <string, string> GetSurveys() { BlobManager BlobManagerObj = new BlobManager("snpdiscovery"); string localPath = "questionnaire/"; var blobSurveys = BlobManagerObj.GetBlobAsync(localPath); return(GetFromSession <Dictionary <string, string> >("SurveyStorage", blobSurveys)); }
public void DeleteSurvey(string surveyId) { BlobManager BlobManagerObj = new BlobManager("snpdiscovery"); // Create a file in your local MyDocuments folder to upload to a blob. string localPath = "questionnaire"; var storage = GetSurveys(); if (storage.Remove(surveyId)) { BlobManagerObj.DeleteBlob(localPath, surveyId); } session.SetString("SurveyStorage", JsonConvert.SerializeObject(storage)); }
public void StoreSurvey(string surveyId, string jsonString) { var storage = GetSurveys(); // Container Name - picture BlobManager BlobManagerObj = new BlobManager("snpdiscovery"); // Create a file in your local MyDocuments folder to upload to a blob. string localPath = "questionnaire"; string sourceFile = System.IO.Path.Combine(localPath, surveyId); var uploadStatus = BlobManagerObj.UploadTextToBlob(sourceFile, jsonString); if (!string.IsNullOrWhiteSpace(uploadStatus) & uploadStatus.Contains(surveyId)) { storage[surveyId] = jsonString; } session.SetString("SurveyStorage", JsonConvert.SerializeObject(storage)); //return task.Result; }
public void ChangeName(string id, string name) //name is new id { // Container Name - picture BlobManager BlobManagerObj = new BlobManager("snpdiscovery"); // Create a file in your local MyDocuments folder to upload to a blob. string localPath = "questionnaire"; string sourceFile = System.IO.Path.Combine(localPath, name); string uploadStatus = ""; var storage = GetSurveys(); storage[name] = storage[id]; //adding new entry uploadStatus = BlobManagerObj.UploadTextToBlob(sourceFile, storage[id]); if (!string.IsNullOrWhiteSpace(uploadStatus) & uploadStatus.Contains(name)) { storage.Remove(id); BlobManagerObj.DeleteBlob(localPath, id); } session.SetString("SurveyStorage", JsonConvert.SerializeObject(storage)); }