コード例 #1
0
 internal static void AddClient(string documentPath, ClientViewModel client)
 {
     var root = XDocument.Load(documentPath).Root;
     root.Add(new XElement("client",
         new XElement("name", client.Name),
         new XElement("city", client.City),
         new XElement("note", client.Note),
         new XElement("imagePath", client.ImagePath),
         new XElement("contractPath",client.ContractPath),
         new XElement("contractDate",client.ContractDate)));
     root.Document.Save(documentPath);
 }
コード例 #2
0
 internal static void DeleteClient(string documenthPath, ClientViewModel client)
 {
     var doc = XDocument.Load(documenthPath);
     doc.Descendants().Where(c => c.Name == client.Name).Remove();
 }