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); }
internal static void DeleteClient(string documenthPath, ClientViewModel client) { var doc = XDocument.Load(documenthPath); doc.Descendants().Where(c => c.Name == client.Name).Remove(); }