feat(api): ApplicationTypeController, GetAll. Application GetAll исправлен фильтр по TypeId
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors.Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.API.Contracts.V1;
|
||||
@@ -23,17 +22,14 @@ namespace PARR.API.Controllers.V1
|
||||
[Authorize(Roles = ParrRoles.Administrator.Role)]
|
||||
public class ApplicationController : BaseApiController
|
||||
{
|
||||
private readonly ILogger<ApplicationController> logger;
|
||||
private readonly IMapper mapper;
|
||||
private readonly IApplicationService applicationService;
|
||||
|
||||
public ApplicationController(
|
||||
ILogger<ApplicationController> logger,
|
||||
IMapper mapper,
|
||||
IApplicationService applicationService
|
||||
)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.mapper = mapper;
|
||||
this.applicationService = applicationService;
|
||||
}
|
||||
@@ -56,8 +52,8 @@ namespace PARR.API.Controllers.V1
|
||||
if (!string.IsNullOrWhiteSpace(filter.Name))
|
||||
query = query.Where(t => t.Name.ToLower().Contains(filter.Name.ToLower()));
|
||||
|
||||
if (filter.Type.HasValue)
|
||||
query = query.Where(t => t.ApplicationType!.Name == filter.Type.Value.ToString());
|
||||
if (filter.TypeId.HasValue)
|
||||
query = query.Where(t => t.ApplicationTypeId == filter.TypeId);
|
||||
|
||||
|
||||
var apps = await applicationService.GetPage(query, paginationFilter).ToListAsync();
|
||||
|
||||
Reference in New Issue
Block a user