35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using DAL.Models.Entities;
|
|
using DAL.Models.Filters;
|
|
using DAL.Repositories;
|
|
using HRD.LDAPService.JWT;
|
|
using HRD.WebApi.Controllers;
|
|
using HRD.WebApi.Repositories;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace StaffDBServer.Controllers
|
|
{
|
|
public class EmployeeController : BaseController<Employee>
|
|
{
|
|
public EmployeeController(IBaseRepository<Employee> repositoryBase) : base(repositoryBase)
|
|
{
|
|
}
|
|
|
|
[HttpPost("EmployeeFullFilter")]
|
|
public async Task<IActionResult> GetEmployeeListAsync([FromBody] EmployeeFullFilter filter)
|
|
{
|
|
try
|
|
{
|
|
var list = await ((EmployeeRepository)EntityRepository).GetListByFilterAsync(filter);
|
|
return new OkObjectResult(list);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.WriteLogException(ex);
|
|
return StatusCode(StatusCodes.Status400BadRequest, $"Cann't get the filtered list of {typeof(Employee).Name}");
|
|
}
|
|
}
|
|
}
|
|
} |