//----< process edit message request >----- public string processEditMessage(XDocument xdoc) { string content = ""; IEnumerable <string> keys = db.Keys(); List <string> keyList = keys.ToList(); string keyToEdit = getKey(xdoc); if (!keyList.Contains(keyToEdit)) { Console.WriteLine("Key {0} is not present in the DB", keyToEdit); } else { int type = getKeyValueType(xdoc); if (type == 1) { DBElement <string, List <string> > element = new DBElement <string, List <string> >(); string key = createAddDBElement(xdoc, out element); if (db.edit(key, element)) { content = key + " record is edited Successfully."; } else { content = key + " record is not edited."; } } } return(content); }
public void processEditMsg(XDocument xdoc, Sender sndr, Message msg) { IEnumerable <string> keys = db.Keys(); List <string> keyList = keys.ToList(); string keyToEdit = getKey(xdoc); if (!keyList.Contains(keyToEdit)) { Message testMsg = new Message(); testMsg.toUrl = msg.fromUrl; testMsg.fromUrl = msg.toUrl; testMsg.content = "\n********************************\n" + "Key " + keyToEdit + " is not present in the DB\n"; sndr.sendMessage(testMsg); } else { DBElement <string, List <string> > element = new DBElement <string, List <string> >(); string key = createAddDBElement(xdoc, out element); Message testMsg = new Message(); testMsg.toUrl = msg.fromUrl; testMsg.fromUrl = msg.toUrl; if (db.edit(key, element)) { testMsg.content = "\n***********************\n" + "Key= " + key + " is edited Successfully.\n"; } else { testMsg.content = "\n**************************\n" + key + " record is not edited.\n"; } sndr.sendMessage(testMsg); } }