AsgQuizzes.Order.Validate C# (CSharp) Method

Validate() public method

public Validate ( ) : void
return void
        public void Validate()
        {
            var lines = this.Lines ?? new OrderLine[] {};
            foreach(var l in lines)
                l.Validate();
            var linesSum = lines.Sum(l => l.LinePrice);
            if (linesSum * (100m - this.Discount) / 100m != this.TotalPrice)
                throw new ValidationException();
        }

Usage Example

Ejemplo n.º 1
0
 public Order New(Order order)
 {
     order.Validate();
     return(_repo.CreateOrder(order));
 }
All Usage Examples Of AsgQuizzes.Order::Validate