Exemple #1
0
        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;
        }
Exemple #2
0
        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));
        }