Feat Telegramas Busquedas
This commit is contained in:
		| @@ -157,4 +157,22 @@ public class CatalogosController : ControllerBase | ||||
|             .Distinct().OrderBy(m => m.Nombre).ToListAsync(); | ||||
|         return Ok(mesas); | ||||
|     } | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Obtiene todos los establecimientos de un municipio, sin necesidad de especificar un circuito. | ||||
|     /// </summary> | ||||
|     [HttpGet("establecimientos-por-municipio/{municipioId}")] | ||||
|     public async Task<IActionResult> GetEstablecimientosPorMunicipio(string municipioId) | ||||
|     { | ||||
|         // Buscamos todos los ámbitos de Nivel 60 (Establecimiento) que pertenezcan | ||||
|         // al Municipio (Nivel 30) a través del campo 'SeccionId'. | ||||
|         var establecimientos = await _dbContext.AmbitosGeograficos.AsNoTracking() | ||||
|             .Where(a => a.NivelId == 60 && a.SeccionId == municipioId && !string.IsNullOrEmpty(a.EstablecimientoId)) | ||||
|             .Select(a => new { Id = a.EstablecimientoId, a.Nombre }) | ||||
|             .Distinct() | ||||
|             .OrderBy(e => e.Nombre) | ||||
|             .ToListAsync(); | ||||
|  | ||||
|         return Ok(establecimientos); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user