/* * Default constructor that initializes all xml and sqlite files. */ public AdminController() { restaurantMenu = new List <MenuItem>(); restaurantCategories = new List <string>(); XmlSerializer xml = new XmlSerializer(typeof(Items)); FileStream fs = new FileStream("XmlSerialization.xml", FileMode.Open); itemList = new Items(); itemList = (Items)xml.Deserialize(fs); restaurantMenu = itemList.ItemsList; foreach (MenuItem item in restaurantMenu) { restaurantCategories.Add(item.categoryAtt); } restaurantCategories = restaurantCategories.Distinct().ToList(); fs.Close(); history = new AdminHistory(restaurantMenu); }
// ---------------------------------------------------------- // Constructor sets itemRemoved and calls the base class. // ---------------------------------------------------------- public RemoveCommand(List <MenuItem> items, MenuItem item, AdminHistory history) : base(items, history) { itemRemoved = item; }
// ---------------------------------------------------------- // Sets itemAdded and calls the base class // with the list. // ---------------------------------------------------------- public UpdateCommand(List <MenuItem> items, MenuItem item, AdminHistory history) : base(items, history) { itemAdded = item; }
public Command(List <MenuItem> items, AdminHistory history) { this.history = history; history.menu = items; }