Esempio n. 1
0
        public IDevice SetDevice(string choiceDevice)
        {
            switch (choiceDevice)
            {
            case "Desktop":
                return(desktop.Clone());

            case "desktop":
                return(desktop.Clone());

            case "Laptop":
                return(laptop.Clone());

            case "laptop":
                return(laptop.Clone());

            case "Notebook":
                return(notebook.Clone());

            case "notebook":
                return(notebook.Clone());

            case "Tablet":
                return(tablet.Clone());

            case "tablet":
                return(tablet.Clone());

            default:
                throw new ArgumentException("This device is not available in our store or you entered the wrong name");
            }
        }
Esempio n. 2
0
 public IDevice GetDevice(string deviceName)
 {
     return(deviceName switch
     {
         "Laptop" => _laptop.Clone(),
         "Desktop" => _desktop.Clone(),
         "Notebook" => _notebook.Clone(),
         "Tablet" => _tablet.Clone(),
         _ => throw new ArgumentException($"Sorry, there is no {deviceName} in our store")
     });
Esempio n. 3
0
        public AbstractDevice GetDevice(string deviceName)
        {
            switch (deviceName)
            {
            case "Laptop":
                return(laptop.Clone());

            case "Desktop":
                return(desktop.Clone());

            case "Notebook":
                return(notebook.Clone());

            case "Tablet":
                return(tablet.Clone());

            default:
                throw new ArgumentException("Unfortunately, our shop does not have this device " +
                                            "or you entered an incorrect name");
            }
        }