static Department DepartmentFromConsole(Mart MyMart) { Console.WriteLine("Enter department name:"); string departmentName = Console.ReadLine().ToString(); return(MyMart.GetDepartment(departmentName)); }
static void Main(string[] args) { IProductsManagement ProductsIntrface; IDepartmentsManagement DepartmentsIntrface; Mart MyMart = new Mart(); DepartmentsIntrface = (IDepartmentsManagement)MyMart; Department MyDepartment = DepartmentsIntrface.AddDepartment("Мир электроники", DepartmentType.Electronics); MyDepartment.Director = "Петров И.И."; ProductsIntrface = (IProductsManagement)MyMart.GetDepartment("Мир электроники"); Product Smartphone = ProductsIntrface.AddProduct("Smartphone Samsung Galaxy J3", ProductType.Electronics); Smartphone.Price = 12500; Smartphone.Manufacter = "Samsung"; ((ElectronicProduct)Smartphone).RamSize = 12000; XmlSerializer xs = new XmlSerializer(typeof(Mart)); MainLoop(MyMart, DepartmentsIntrface, xs); }