コード例 #1
0
        public BuyCommand(IReadOnlyCollection<Coin> deposit, GoodsIdentity goods)
        {
            Contract.Requires(deposit != null);
            Contract.Requires(!goods.Equals(default(GoodsIdentity)));

            Deposit = deposit;
            Goods = goods;
        }
コード例 #2
0
        public BuyCommand(IReadOnlyCollection <Coin> deposit, GoodsIdentity goods)
        {
            Contract.Requires(deposit != null);
            Contract.Requires(!goods.Equals(default(GoodsIdentity)));

            Deposit = deposit;
            Goods   = goods;
        }
コード例 #3
0
        public JsonResult Buy(IEnumerable<CoinViewModel> deposit, Guid goodsIdentity)
        {
            Contract.Requires(deposit != null);
            Contract.Requires(goodsIdentity != default(Guid));

            var depositCoins = deposit
                .Select(x => new Coin(x.ParValue, x.Count))
                .ToArray();
            var goods = new GoodsIdentity(goodsIdentity);
            Contract.Assume(!goods.Equals(default(GoodsIdentity)));
            var command = new BuyCommand(depositCoins, goods);
            var @event = _buyCommandHandler.Execute(command);

            return Json(@event);
        }
コード例 #4
0
        public JsonResult Buy(IEnumerable <CoinViewModel> deposit, Guid goodsIdentity)
        {
            Contract.Requires(deposit != null);
            Contract.Requires(goodsIdentity != default(Guid));

            var depositCoins = deposit
                               .Select(x => new Coin(x.ParValue, x.Count))
                               .ToArray();
            var goods = new GoodsIdentity(goodsIdentity);

            Contract.Assume(!goods.Equals(default(GoodsIdentity)));
            var command = new BuyCommand(depositCoins, goods);
            var @event  = _buyCommandHandler.Execute(command);

            return(Json(@event));
        }