public Order() { deliveryAddress = new Address(); lineItems = new List<LineItem>(); validationFuncs = new Dictionary<string, Func<string>> { {"UserName", () => string.IsNullOrEmpty(UserName)? "User Name should not be empty": string.Empty}, {"NeedDelivery", () => NeedDelivery == null? "Please select if you need delivery.": string.Empty}, {"DeliveryAddress", () => (NeedDelivery != null && NeedDelivery.Value && !DeliveryAddress.IsValid)? "Address is invalid.": string.Empty}, {"LineItems", () => LineItems.Any(item => !item.IsValid) ? "Line items are invalid.": string.Empty} }; }
public AddressViewModel(Address address) { this.address = address; }