You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
884 B
C#

6 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DesignPatternStudy.Learn.StrategyPattern.NoPattern
{
public class NoStrategyPattern
{
public decimal GetPrice(decimal sourcePrice, int priceType)
{
decimal discountPrice = sourcePrice;
switch (priceType)
{
case 1:
discountPrice = sourcePrice * 0.9m;
break;
case 2:
discountPrice = sourcePrice - 10m;
break;
case 3:
discountPrice = sourcePrice - 100m;
break;
default:
discountPrice = sourcePrice;
break;
}
return discountPrice;
}
}
}