public List <Branch> GetBranchesList() { List <Branch> list = new List <Branch>(); foreach (XElement BranchElement in BranchesRoot.Elements()) { list.Add(getBranch(int.Parse(BranchElement.Element("Number").Value))); } return(list); }
public void RemoveBranch(Branch B) { XElement BranchElement; BranchElement = (from b in BranchesRoot.Elements() where Convert.ToInt32(b.Element("Number").Value) == B.Number && b.Element("BranchSituation").Value == BranchSituation.EXIST.ToString() select b).FirstOrDefault(); BranchElement.Element("BranchSituation").Value = BranchSituation.CLOSED.ToString(); BranchesRoot.Save(BranchesPath); }