DigitalData.StaffDBServer/StaffDBServer/Controllers/WindreamSearchItemToWindreamSearchToDepartmentController.cs

36 lines
1.4 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
{
[JWTAuthorize]
public class WindreamSearchItemToWindreamSearchToDepartmentController : BaseController<WindreamSearchItemToWindreamSearchToDepartment>
{
public WindreamSearchItemToWindreamSearchToDepartmentController(IBaseRepository<WindreamSearchItemToWindreamSearchToDepartment> repositoryBase) : base(repositoryBase)
{
}
[HttpPost("WindreamSearchToDepartmentFilter")]
public async Task<IActionResult> GetWindreamSearchItemToWindreamSearchToDepartmentListAsync([FromBody] WindreamSearchToDepartmentFilter filter)
{
try
{
var list = await ((WindreamSearchItemToWindreamSearchToDepartmentRepository)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(WindreamSearchItemToWindreamSearchToDepartment).Name}");
}
}
}
}