29 lines
954 B
C#
29 lines
954 B
C#
using DAL.Models.Entities;
|
|
using DAL.Models.Filters;
|
|
using HRD.WebApi.Repositories;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DAL.Repositories
|
|
{
|
|
public class EmployeeToDepartmentRepository : BaseRepository<EmployeeToDepartment>
|
|
{
|
|
public EmployeeToDepartmentRepository(WebApiContext context) : base(context)
|
|
{
|
|
}
|
|
|
|
public async Task<List<EmployeeToDepartment>> GetListByFilterAsync(EmployeeFilter filter, bool asNoTracking = true)
|
|
{
|
|
var items = this.RepositoryContext.Set<EmployeeToDepartment>().AsQueryable();
|
|
|
|
if (filter.EmployeeId != null && filter.EmployeeId != 0)
|
|
{
|
|
items = items.Where(x => x.EmployeeId == filter.EmployeeId);
|
|
}
|
|
|
|
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
|
}
|
|
}
|
|
} |