示例#1
0
        public CampaignResult Apply(CampaignInput input)
        {
            var result = new CampaignResult()
            {
                IsSuccess = true
            };

            try
            {
                Validation(input);
                result.Discount = GetDiscount();
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.ExMessage = ex.Message;
            }

            return(result);
        }
示例#2
0
 protected abstract void Validation(CampaignInput input);
示例#3
0
 protected override void Validation(CampaignInput input)
 {
     Condition.Requires(input.OrderTotal).IsGreaterThan(50);
 }