This commit is contained in:
@@ -4,6 +4,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
using AyaNova.Models;
|
||||
using AyaNova.Api.ControllerHelpers;
|
||||
using AyaNova.Biz;
|
||||
@@ -151,6 +153,20 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get count of PartWarehouses
|
||||
/// </summary>
|
||||
/// <returns>Total number of part warehouses (active or not)</returns>
|
||||
[HttpGet("count")]
|
||||
public async Task<IActionResult> GetCount()
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (!Authorized.HasSelectRole(HttpContext.Items, AyaType.PartWarehouse))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
return Ok(ApiOkResponse.Response(await ct.PartWarehouse.CountAsync()));
|
||||
}
|
||||
|
||||
|
||||
//------------
|
||||
|
||||
Reference in New Issue
Block a user