29 lines
970 B
C#
29 lines
970 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 DocumentArtToDepartmentRepository : BaseRepository<DocumentArtToDepartment>
|
|
{
|
|
public DocumentArtToDepartmentRepository() : base(new WebApiContext())
|
|
{
|
|
}
|
|
|
|
public async Task<List<DocumentArtToDepartment>> GetListByFilterAsync(DepartmentFilter filter, bool asNoTracking = true)
|
|
{
|
|
var items = this.RepositoryContext.Set<DocumentArtToDepartment>().AsQueryable();
|
|
|
|
if (filter.DepartmentId != null && filter.DepartmentId != 0)
|
|
{
|
|
items = items.Where(x => x.DepartmentId == filter.DepartmentId);
|
|
}
|
|
|
|
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
|
}
|
|
}
|
|
} |