public static List<LicenseMessage> ValidateThis(this NavOrder order, List<License> licensesInOrder) { var returnMessages = new List<LicenseMessage>(); if (order.IsActionValid() == null) { returnMessages.Add(order.IsActionValid()); return returnMessages; } returnMessages.Add(order.IsProductOrdersEmpty()); returnMessages.Add(order.IsOrderNumberGreaterThan20()); returnMessages.AddRange(order.DoesNumberOfUsersExceed5000()); returnMessages.Add(order.IsOrderNumberNullOrEmpty()); returnMessages.Add(order.IsProductOrdersEmpty()); returnMessages.AddRange(order.AreThereEmptyLicenseKeys()); if (order.Action == (int) ActionEnum.Create) { order.ValidateOrderForNewLicense(licensesInOrder.GetLicenseKeysFromLicenseList()); } else { order.ValidateUpdateOrder(licensesInOrder); } return returnMessages; }
internal static List<LicenseMessage> ValidateOrderForNewLicense(this NavOrder order, List<string> existingLicenseList ) { var returnMessageList = new List<LicenseMessage>(); foreach (var licenseMessage in order.AreThereEmptyLicenseKeys() ) { returnMessageList.AddIfNotNull(licenseMessage); } foreach (var licenseMessage in order.DoesProductListContainLicenseKey(existingLicenseList)) { returnMessageList.AddIfNotNull(licenseMessage); } return returnMessageList; }