Ejemplo n.º 1
0
        public IHttpActionResult GetMoneda (String Id)
        {
            IMonedaStrategy MonedaStrategy;
            switch (Id)
            {
                case "Peso":
                    MonedaStrategy = new PesoStrategy();

                    break;
                case "Dolar":
                    MonedaStrategy = new DolarStrategy();
                    break;
                case "Real":

                    MonedaStrategy = new RealStrategy();
                    break;
                default:
                    throw new UnauthorizedAccessExceptionSinTrace();
            }
            return Ok( MonedaStrategy.getMoneda());

        }
Ejemplo n.º 2
0
        public static IMoneyStrategy GetMoneyStrategy(string money)
        {
            IMoneyStrategy moneyStrategy = null;

            switch (money.ToUpper())
            {
            case PESOS:
                moneyStrategy = new PesosStrategy();
                break;

            case REAL:
                moneyStrategy = new RealStrategy();
                break;

            case DOLAR:
                moneyStrategy = new DolarStrategy();
                break;

            default:
                moneyStrategy = new DefaultStrategy();
                break;
            }
            return(moneyStrategy);
        }