private bool validarDadesFormulari() { bool TeamNameValid = false; bool FullNameValid = false; bool TeamChiefValid = false; bool ChassisValid = false; bool PowerUnitValid = false; bool FirstTeamEntryValid = false; bool WorldChampionshipsValid = false; bool FastestLapsValid = false; bool DescriptionValid = false; bool UriLogoValid = false; bool UriCarValid = false; if (!TeamViewModel.TeamNameValid(Team.TeamName)) { txtTeamName.Background = new SolidColorBrush(Colors.LightCoral); txbErrorTeamName.Text = "Mandatory Field"; } else { txtTeamName.Background = new SolidColorBrush(Colors.Transparent); txbErrorTeamName.Text = ""; TeamNameValid = true; } if (!TeamViewModel.FullNameValid(Team.FullName)) { txtFullName.Background = new SolidColorBrush(Colors.LightCoral); txbErrorFullName.Text = "Mandatory Field"; } else { txtFullName.Background = new SolidColorBrush(Colors.Transparent); txbErrorFullName.Text = ""; FullNameValid = true; } if (!TeamViewModel.TeamChiefValid(Team.TeamChief)) { txtTeamChief.Background = new SolidColorBrush(Colors.LightCoral); txbErrorTeamChief.Text = "Mandatory Field"; } else { txtTeamChief.Background = new SolidColorBrush(Colors.Transparent); txbErrorTeamChief.Text = ""; TeamChiefValid = true; } if (!TeamViewModel.ChassisValid(Team.Chassis)) { txtChassis.Background = new SolidColorBrush(Colors.LightCoral); txbErrorChassis.Text = "Mandatory Field"; } else { txtChassis.Background = new SolidColorBrush(Colors.Transparent); txbErrorChassis.Text = ""; ChassisValid = true; } if (!TeamViewModel.PowerUnitValid(Team.PowerUnit)) { txtPowerUnit.Background = new SolidColorBrush(Colors.LightCoral); txbErrorPowerUnit.Text = "Mandatory Field"; } else { txtPowerUnit.Background = new SolidColorBrush(Colors.Transparent); txbErrorPowerUnit.Text = ""; PowerUnitValid = true; } if (!TeamViewModel.FirstTeamEntryValid(Team.FirstTeamEntry)) { txtFirstTeamEntry.Background = new SolidColorBrush(Colors.LightCoral); } else { txtFirstTeamEntry.Background = new SolidColorBrush(Colors.Transparent); FirstTeamEntryValid = true; } if (!TeamViewModel.WorldChampionshipsValid(Team.WorldChampionships)) { txtWorldChampionships.Background = new SolidColorBrush(Colors.LightCoral); } else { txtWorldChampionships.Background = new SolidColorBrush(Colors.Transparent); WorldChampionshipsValid = true; } if (!TeamViewModel.FastestLapsValid(Team.FastestLaps)) { txtFastestLaps.Background = new SolidColorBrush(Colors.LightCoral); } else { txtFastestLaps.Background = new SolidColorBrush(Colors.Transparent); FastestLapsValid = true; } if (!TeamViewModel.DescriptionValid(Team.Description)) { txtDesc.Background = new SolidColorBrush(Colors.LightCoral); txbErrorDesc.Text = "Mandatory Field"; } else { txtDesc.Background = new SolidColorBrush(Colors.Transparent); txbErrorDesc.Text = ""; DescriptionValid = true; } if (TeamViewModel.UriLogoValid(Team.UriLogo)) { UriLogoValid = true; } if (TeamViewModel.UriCarValid(Team.UriCar)) { UriCarValid = true; } return(TeamNameValid && FullNameValid && TeamChiefValid && ChassisValid && PowerUnitValid && FirstTeamEntryValid && WorldChampionshipsValid && FastestLapsValid && DescriptionValid && UriLogoValid && UriCarValid); }