diff --git a/ManagerService/Controllers/SectionController.cs b/ManagerService/Controllers/SectionController.cs
index f0eb641..f6f4b13 100644
--- a/ManagerService/Controllers/SectionController.cs
+++ b/ManagerService/Controllers/SectionController.cs
@@ -230,6 +230,38 @@ namespace ManagerService.Controllers
}
}
+ ///
+ /// Get all section with beacon
+ ///
+ /// Instance id
+ [AllowAnonymous]
+ [ProducesResponseType(typeof(List), 200)]
+ [ProducesResponseType(typeof(string), 404)]
+ [ProducesResponseType(typeof(string), 500)]
+ [HttpGet("beacons/{id}")]
+ public ObjectResult GetAllBeaconsForInstance(string id)
+ {
+ try
+ {
+ List sections = _sectionService.GetAll(id);
+
+ if (sections.Count == 0)
+ throw new KeyNotFoundException("No section has beacon");
+
+ sections = sections.Where(s => s.IsBeacon && s.BeaconId != null).ToList();
+
+ return new OkObjectResult(sections.Select(s => s.ToDTO()));
+ }
+ catch (KeyNotFoundException ex)
+ {
+ return new NotFoundObjectResult(ex.Message) { };
+ }
+ catch (Exception ex)
+ {
+ return new ObjectResult(ex.Message) { StatusCode = 500 };
+ }
+ }
+
///
/// Create a new section
///