Пример #1
0
        public ICommand GetCommand(CartOperationEnum cartOperationEnum)
        {
            switch (cartOperationEnum)
            {
            case CartOperationEnum.Create:
                return(new CreateCommand());

            case CartOperationEnum.Delete:
                return(new DeleteCommand());

            default:
                throw new ArgumentException($"{nameof(cartOperationEnum)} is invalid command");
            }
        }
Пример #2
0
 public void SetCommand(CartOperationEnum cartOperationEnum)
 {
     _command = _commandFactory.GetCommand(cartOperationEnum: cartOperationEnum);
 }