private bool ValidateInput(string name) { var valid = true; if (name.Equals("business")) { businessName.ClearValue(TextBox.BorderBrushProperty); businessAddress.ClearValue(TextBox.BorderBrushProperty); businessType.ClearValue(TextBox.BorderBrushProperty); NameValidationMessage.Visibility = Visibility.Collapsed; AddressValidationMessage.Visibility = Visibility.Collapsed; if (EditPlaceViewModel.BusinessViewModel.Name == null || EditPlaceViewModel.BusinessViewModel.Name.Trim().Length == 0) { businessName.BorderBrush = new SolidColorBrush(Colors.Red); valid = false; NameValidationMessage.Visibility = Visibility.Visible; } if (EditPlaceViewModel.BusinessViewModel.Address == null || EditPlaceViewModel.BusinessViewModel.Address.Trim().Length == 0) { businessAddress.BorderBrush = new SolidColorBrush(Colors.Red); valid = false; AddressValidationMessage.Visibility = Visibility.Visible; } } if (name.Equals("event")) { EventName.ClearValue(TextBox.BorderBrushProperty); EventType.ClearValue(TextBox.BorderBrushProperty); EventDescription.ClearValue(TextBox.BorderBrushProperty); EventNameValidationMessage.Visibility = Visibility.Collapsed; EventTypeValidationMessage.Visibility = Visibility.Collapsed; EventDescriptionValidationMessage.Visibility = Visibility.Collapsed; if (EventViewModel.Name == null || EventViewModel.Name.Trim().Length == 0) { EventName.BorderBrush = new SolidColorBrush(Colors.Red); valid = false; EventNameValidationMessage.Visibility = Visibility.Visible; } if (EventViewModel.Type == null || EventViewModel.Type.Trim().Length == 0) { EventType.BorderBrush = new SolidColorBrush(Colors.Red); valid = false; EventTypeValidationMessage.Visibility = Visibility.Visible; } if (EventViewModel.Description == null || EventViewModel.Description.Trim().Length == 0) { EventDescription.BorderBrush = new SolidColorBrush(Colors.Red); valid = false; EventDescriptionValidationMessage.Visibility = Visibility.Visible; } } if (name.Equals("promotion")) { PromotionName.ClearValue(TextBox.BorderBrushProperty); PromotionDescription.ClearValue(TextBox.BorderBrushProperty); PromotionNameValidationMessage.Visibility = Visibility.Collapsed; PromotionDescriptionValidationMessage.Visibility = Visibility.Collapsed; PromotionDateValidationMessage.Visibility = Visibility.Collapsed; if (PromotionViewModel.Name == null || PromotionViewModel.Name.Trim().Length == 0) { PromotionName.BorderBrush = new SolidColorBrush(Colors.Red); valid = false; PromotionNameValidationMessage.Visibility = Visibility.Visible; } if (PromotionViewModel.Description == null || PromotionViewModel.Description.Trim().Length == 0) { PromotionDescription.BorderBrush = new SolidColorBrush(Colors.Red); valid = false; PromotionDescriptionValidationMessage.Visibility = Visibility.Visible; } if (1 == DateTimeOffset.Compare(PromotionViewModel.StartDateOffset, PromotionViewModel.EndDateOffset)) { startDate.BorderBrush = new SolidColorBrush(Colors.Red); endDate.BorderBrush = new SolidColorBrush(Colors.Red); valid = false; PromotionDateValidationMessage.Visibility = Visibility.Visible; } } return(valid); }