public List <Dish> GetDishesList() { List <Dish> list = new List <Dish>(); foreach (XElement DishElement in DishesRoot.Elements()) { list.Add(getDish(int.Parse(DishElement.Element("ID").Value))); } return(list); }
public void RemoveDish(Dish D) { XElement DishElement; DishElement = (from d in DishesRoot.Elements() where Convert.ToInt32(d.Element("ID").Value) == D.DishID && d.Element("DishSituation").Value == DishSituation.EXIST.ToString() select d).FirstOrDefault(); DishElement.Element("DishSituation").Value = DishSituation.REMOVED.ToString(); DishesRoot.Save(DishesPath); }