- 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.
41 lines
1.6 KiB
C#
41 lines
1.6 KiB
C#
using DAL.Models.Entities;
|
|
using DAL.Models.Filters;
|
|
using HRD.WebApi.Repositories;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Logging;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DAL.Repositories
|
|
{
|
|
public class DepartmentToWebAppToEmployeeForWindreamRepository : BaseRepository<DepartmentToWebAppToEmployeeForWindream>
|
|
{
|
|
public DepartmentToWebAppToEmployeeForWindreamRepository(WebApiContext context, ILogger<DepartmentToWebAppToEmployeeForWindreamRepository> logger) : base(context, logger)
|
|
{
|
|
}
|
|
|
|
public async Task<List<DepartmentToWebAppToEmployeeForWindream>> GetListByFilterAsync(EmployeeFilter filter, bool asNoTracking = true)
|
|
{
|
|
var items = this.RepositoryContext.Set<DepartmentToWebAppToEmployeeForWindream>().AsQueryable();
|
|
|
|
if (filter.EmployeeId != null && filter.EmployeeId != 0)
|
|
{
|
|
items = items.Where(x => x.EmployeeId == filter.EmployeeId);
|
|
return asNoTracking ? await items.ToListAsync() : await items.ToListAsync();
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(filter.ShortName))
|
|
{
|
|
items = items.Where(x => x.ShortName == filter.ShortName);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(filter.LoginName))
|
|
{
|
|
items = items.Where(x => x.LoginName.ToLower() == filter.LoginName.ToLower());
|
|
}
|
|
|
|
return asNoTracking ? await items.OrderBy(x => x.DepartmentName).AsNoTracking().ToListAsync() : await items.OrderBy(x => x.DepartmentName).ToListAsync();
|
|
}
|
|
}
|
|
} |