feat(api): ResponseAreaController getAll. WorkGroupController, getAll, добавлен фильтр по ЗО.
This commit is contained in:
@@ -9,6 +9,7 @@ using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Extensions;
|
||||
using PARR.Constants;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
@@ -50,6 +51,15 @@ namespace PARR.API.Controllers.V1
|
||||
if (!string.IsNullOrEmpty(filter.Name))
|
||||
query = query.Where(t => t.Name.ToLower().Contains(filter.Name.ToLower()));
|
||||
|
||||
if (filter.ResponseAreaCode.HasValue)
|
||||
{
|
||||
//todo: validate ResponseAreaEnum
|
||||
if (!Enum.IsDefined(typeof(ResponseAreaEnum), filter.ResponseAreaCode.Value))
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { FieldName = nameof(filter.ResponseAreaCode), Message = "Неверное значение" } }));
|
||||
|
||||
query = query.Where(t => t.ResponseAreaCode == filter.ResponseAreaCode.Value);
|
||||
}
|
||||
|
||||
var workGroups = await workGroupService.GetPage(query, paginationFilter).ToListAsync();
|
||||
|
||||
if (!workGroups.Any())
|
||||
|
||||
Reference in New Issue
Block a user