public void AddDevice(string device = "", string name = "", string fabricator = "")
 {
     DatabaseMapping databaseMapping = null;
     switch (device)
     {
         case "clock":
             Clock clock = new Clock(name);
             _deviceContext.Clocks.Add(clock);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 1, Clock = clock };
             break;
         case "microwave":
             MicrowaveFabricatorInfo mi = microwaveFabricatorInfo[fabricator];
             Microwave microwave = new Microwave(name, mi.Volume, mi.Lamp);
             _deviceContext.Microwaves.Add(microwave);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 2, Microwave = microwave };
             break;
         case "oven":
             OvenFabricatorInfo oi = ovenFabricatorInfo[fabricator];
             Oven oven = new Oven(name, oi.Volume, oi.Lamp);
             _deviceContext.Ovens.Add(oven);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 3, Oven = oven };
             break;
         case "fridge":
             FridgeFabricatorInfo fi = fridgeFabricatorInfo[fabricator];
             Fridge fridge = new Fridge(name, fi.Coldstore, fi.Freezer);
             _deviceContext.Fridges.Add(fridge);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 4, Fridge = fridge };
             break;
         default: return;
     }
     _deviceContext.DatabaseMappings.Add(databaseMapping);
     _deviceContext.SaveChanges();
 }
 public void AddMicrowave(string name, string fabricator)
 {
     if (!microwaveInfo.ContainsKey(fabricator))
     {
         return;
     }
     MicrowaveInfo mi = microwaveInfo[fabricator];
     Microwave microwave = new Microwave(name, mi.Volume, mi.Lamp);
     microwave.OperationDone += (sender) =>
     {
         //throw new ApplicationException("Микроволновка отработала!!!");
     };
     AddDevice(microwave);
 }