public IActionResult GetMunicipalitiesOfMexicoByStateOfMexicoName(string nameOfState) { if (string.IsNullOrEmpty(nameOfState)) { return(BadRequest("nameOfState cannot be null or empty")); } var municipalities = registrationRequestRepository.GetMunicipalitiesOfMexicoByStateOfMexicoName(nameOfState); if (municipalities == null || municipalities.Count() == 0) { return(NotFound("No record found")); } return(Ok(municipalities.ToList())); }
public void LoadMunicipalitiesOfMexico(IRegistrationRequest registrationRequestRepository) { if (string.IsNullOrEmpty(Requestor?.Address?.State) || Requestor?.Address?.State.StartsWith("Selecciona") == true) { MunicipalitiesOfMexico = new List <MunicipalitiesOfMexico>(); MunicipalitiesOfMexico.Add(new MunicipalitiesOfMexico() { Nombre = "Selecciona un municipio" }); } else { MunicipalitiesOfMexico = registrationRequestRepository .GetMunicipalitiesOfMexicoByStateOfMexicoName(Requestor.Address.State).ToList(); } }
public ActionResult GetMunicipalitiesOfMexico(string nameOfState) { if (string.IsNullOrEmpty(nameOfState)) { return(null); } System.Collections.Generic.List <Naandi.Shared.Models.MunicipalitiesOfMexico> MunicipalitiesOfMexico = registrationRequestRepository.GetMunicipalitiesOfMexicoByStateOfMexicoName(nameOfState).ToList(); return(Json(MunicipalitiesOfMexico)); }