コード例 #1
0
ファイル: GiftController.cs プロジェクト: iJzFan/backup
        public IActionResult ShipView(long giftOrderId)
        {
            var model = new CHIS.Models.CHIS_Gift_Order()
            {
                GiftOrderId = giftOrderId
            };

            return(PartialView("_pvShipView", model));
        }
コード例 #2
0
        /// <summary>
        /// 兑换礼品
        /// </summary>
        /// <param name="order"></param>
        public void ExchangeGift(CHIS_Gift_Order order)
        {
            if (this.GiftOrderList == null)
            {
                this.GiftOrderList = new List <CHIS_Gift_Order>();
            }

            this.GiftOrderList.Add(order);

            order.Gift.Stock = order.Gift.Stock - order.Count;

            if (order.Gift.Stock < 0)
            {
                throw new ApplicationException("库存不足");
            }

            var points = this.Points - (order.Gift.NeedPoints * order.Count);

            if (points < 0)
            {
                throw new ApplicationException("积分不足");
            }
        }