private async void butonCircular1_Click(object sender, EventArgs e) { System.Text.RegularExpressions.Regex name = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z]+$"); if (CityNameTb.TextLength == 0) { errorProviderCityName.SetError(CityNameTb, "You have to introduce the name"); } else { errorProviderCityName.SetError(CityNameTb, ""); } if (CityCodTb.TextLength == 0) { errorProviderCityCod.SetError(CityCodTb, "You have to introduce the code"); } else { errorProviderCityCod.SetError(CityCodTb, ""); } if (!name.IsMatch(CityNameTb.Text)) { errorProviderCityName.SetError(CityNameTb, "The name should contain only letters"); } else { errorProviderCityName.SetError(CityNameTb, ""); } if (!name.IsMatch(CityCodTb.Text)) { errorProviderCityCod.SetError(CityCodTb, "The code should contain only letters"); } else { errorProviderCityCod.SetError(CityCodTb, ""); } if (CityNameTb.TextLength <= 3) { errorProviderCityName.SetError(CityNameTb, "Such city does not exist"); } else { errorProviderCityName.SetError(CityNameTb, ""); } if (CityCodTb.TextLength == 1) { errorProviderCityCod.SetError(CityCodTb, "This code is not explicit"); } else { errorProviderCityCod.SetError(CityCodTb, ""); } if (editCity == null && errorProviderCityCod.GetError(CityCodTb) == "" && errorProviderCityName.GetError(CityNameTb) == "") { // PostAddCity(); getAddConferenceCityRepository.insertCity(maxCityId + 1, getDistrictId(), CityCodTb.Text, CityNameTb.Text); this.Close(); } else if (editCity != null && errorProviderCityCod.GetError(CityCodTb) == "" && errorProviderCityName.GetError(CityNameTb) == "") { //await PostUpdateCity(editCity.DictionaryCityId, CityCodTb.Text, CityNameTb.Text, getDistrictId()); getAddConferenceCityRepository.updateCity(editCity.DictionaryCityId, CityCodTb.Text, CityNameTb.Text, getDistrictId()); this.Close(); } else { // do nothing } }
public IActionResult UpdateCity([FromBody] AddConferenceCityModel city) { _getDictionaryCityRepository.updateCity(city.DictionaryCityId, city.CityCode, city.DictionaryCityName, city.DictionaryDistrictId); return(Ok()); }