- App Logger entfernt und durch die Implementierung des `ILogger`-Interfaces ersetzt, um eine konsistente Logging-Architektur zu gewährleisten. - API für die Nutzung von NLog konfiguriert, um eine leistungsstarke und flexible Logging-Lösung bereitzustellen. - Konfigurationsdateien und Setup-Anpassungen für die Integration von NLog in die API vorgenommen.
55 lines
2.1 KiB
C#
55 lines
2.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 Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace StaffDBServer.Controllers
|
|
{
|
|
[JWTAuthorize]
|
|
public class DepartmentController : BaseController<Department>
|
|
{
|
|
public DepartmentController(IBaseRepository<Department> repositoryBase, ILogger<DepartmentController> logger) : base(repositoryBase, logger)
|
|
{
|
|
}
|
|
|
|
[HttpPost("DepartmentFullFilter")]
|
|
public async Task<IActionResult> GetDepartmentListAsync([FromBody] DepartmentFullFilter filter)
|
|
{
|
|
try
|
|
{
|
|
var list = await ((DepartmentRepository)EntityRepository).GetDepartmentListAsync(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}");
|
|
}
|
|
}
|
|
|
|
[HttpPut("CopyWindreamTiles/{DepartmentId}")]
|
|
public async Task<IActionResult> GetVisitorListAsync(int DepartmentId, [FromBody] List<int> trgDepartmentIds)
|
|
{
|
|
var strTrgDepartmentIds = string.Join(",", trgDepartmentIds);
|
|
try
|
|
{
|
|
await ((DepartmentRepository)EntityRepository).ReplaceWindreamTiles(DepartmentId, strTrgDepartmentIds);
|
|
this.WriteLogWarn($"Windream Search Tiles from Department Id={DepartmentId} are replaced Tiles in the Departments with Ids={strTrgDepartmentIds}");
|
|
return new OkObjectResult(true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.WriteLogException(ex);
|
|
return StatusCode(StatusCodes.Status400BadRequest, $"Windream Search Tiles from Department Id={DepartmentId} cann't replace Tiles in the Departments with Ids={strTrgDepartmentIds}");
|
|
}
|
|
}
|
|
}
|
|
} |