Ejemplo n.º 1
0
        public virtual PointRedemption RedeemPoint(IList <Merchandise> merchandises, string remark = @"")
        {
            if (!IsInActiveMembership)
            {
                throw new ApplicationException(@"Customer is not in active membership");
            }

            var totalPointNeeded = merchandises.Sum(x => x.PointCost);

            if (totalPointNeeded > _membership.Point)
            {
                throw new ApplicationException(@"Not enough points, " + totalPointNeeded + @" needed");
            }

            var pointRedemption = new PointRedemption(this, remark);

            foreach (var merchandise in merchandises)
            {
                pointRedemption.AddRedemptionItem(merchandise, 1);

                _membership.UsePoint(merchandise.PointCost);
            }

            return(pointRedemption);
        }
Ejemplo n.º 2
0
        public virtual PointRedemption RedeemPoint(IList<Merchandise> merchandises, string remark = @"")
        {
            if (!IsInActiveMembership)
            {
                throw new ApplicationException(@"Customer is not in active membership");
            }

            var totalPointNeeded = merchandises.Sum(x => x.PointCost);

            if (totalPointNeeded > _membership.Point)
            {
                throw new ApplicationException(@"Not enough points, " + totalPointNeeded + @" needed");
            }

            var pointRedemption = new PointRedemption(this, remark);

            foreach (var merchandise in merchandises)
            {
                pointRedemption.AddRedemptionItem(merchandise, 1);

                _membership.UsePoint(merchandise.PointCost);
            }

            return pointRedemption;
        }