Get layer by number

This commit is contained in:
Michał Zieliński
2023-12-26 11:42:51 +01:00
parent 99ce634ca9
commit bc3bd21eb2

View File

@@ -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)
{