public IComputerFactory Create(EmployeeModel emp)
        {
            IComputerFactory returnvalue = null;

            if (emp.EmployeeId == 1)
            {
                if (emp.JobDescription == "Manger")
                {
                    returnvalue = new MacLaptopFactory();
                }
                else
                {
                    returnvalue = new MacDesktopFactory();
                }
            }
            else if (emp.EmployeeId == 2)
            {
                if (emp.JobDescription == "Manger")
                {
                    returnvalue = new DellLaptopFactory();
                }
                else
                {
                    returnvalue = new DellDesktopFactory();
                }
            }

            return(returnvalue);
        }
        public IComputerFactory Create(Employee e)
        {
            IComputerFactory returnValue = null;

            if (e.EmployeeTypeID == 1)
            {
                if (e.JobDescription == "Manager")
                {
                    returnValue = new MACLaptopFactory();
                }
                else
                {
                    returnValue = new MACDesktopFactory();
                }
            }
            else if (e.EmployeeTypeID == 2)
            {
                if (e.JobDescription == "Manager")
                {
                    returnValue = new DellLaptopFactory();
                }
                else
                {
                    returnValue = new DellDesktopFactory();
                }
            }
            return(returnValue);
        }
Beispiel #3
0
 public static IDeviceFactory GetDevice(IBaseEmployee employee)
 {
     return(employee.RequestedDeviceType switch
     {
         DeviceType.Laptop => DellLaptopFactory.GetDevice(employee),
         DeviceType.Desktop => DellDesktopFactory.GetDevice(employee),
         _ => DellDesktopFactory.GetDevice(employee)
     });