Example #1
0
        public static LingkEnvelope CheckEnvelopeExists(string filePath, LingkEnvelope envelope)
        {
            var jsonData = System.IO.File.ReadAllText(filePath);
            // De-serialize to object or create new list
            var envelopeList = JsonConvert.DeserializeObject <List <LingkEnvelope> >(jsonData) ?? new List <LingkEnvelope>();

            var result = envelopeList.Find((e) =>
            {
                return(e.accountId == envelope.accountId && e.templateId == envelope.templateId);
            });

            return(result);
        }
Example #2
0
        public static void AddDocusignEnvelope(string filePath, LingkEnvelope envelope)
        {
            // Read existing json data
            var jsonData = System.IO.File.ReadAllText(filePath);
            // De-serialize to object or create new list
            var envelopeList = JsonConvert.DeserializeObject <List <LingkEnvelope> >(jsonData) ?? new List <LingkEnvelope>();

            // Add any new envelope
            envelopeList.Add(envelope);

            // Update json data string
            jsonData = JsonConvert.SerializeObject(envelopeList);
            System.IO.File.WriteAllText(filePath, jsonData);
        }