diff --git a/WebAPI/Controllers/LayersController.cs b/WebAPI/Controllers/LayersController.cs index 4692820..e38baff 100644 --- a/WebAPI/Controllers/LayersController.cs +++ b/WebAPI/Controllers/LayersController.cs @@ -78,8 +78,7 @@ namespace WebAPI.Controllers } } [HttpGet] - [Route("{id}")] - public IActionResult Get(Guid id) + [Route("{id}")] public IActionResult Get(Guid id) { try { @@ -94,6 +93,26 @@ namespace WebAPI.Controllers } } [HttpGet] + [Route("getByNumber/{apiKey}/{number}")] + public IActionResult GetByNumber(string apiKey, int number) + { + if (apiKey != configuration["apiKey"]) + { + return Unauthorized(); + } + try + { + return Ok(db.Layers + .Include(x => x.CreatedBy) + .Include(x => x.Records) + .Where(x => x.Number == number && !x.IsDeleted).First()); + } + catch (Exception e) + { + return BadRequest(e.ToString()); + } + } + [HttpGet] [Route("exportToGoogleSheet/{id}")] public IActionResult ExportToGoogleSheet(Guid id) {