public ApplyDiscount ( System.Guid orderId, decimal discount ) : |
||
orderId | System.Guid | |
discount | decimal | |
return |
public Order ApplyDiscount(Guid orderId, decimal discount)
{
var order = _repo.ReadOrder(orderId);
order.Discount = discount;
order.TotalPrice = order.TotalPrice*(100m - order.Discount)/100m;
order.Validate();
return _repo.UpdateOrder(order);
}