38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using Marco.Pms.DataAccess.Data;
|
|
using Marco.Pms.Model.Projects;
|
|
using Microsoft.CodeAnalysis;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
namespace ModelServices.Helpers
|
|
{
|
|
public class ProjectHelper
|
|
{
|
|
private readonly ApplicationDbContext _context;
|
|
public ProjectHelper(ApplicationDbContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public async Task<List<ProjectAllocation>> GetTeamByProject(Guid TenantId, Guid ProjectId, bool IncludeInactive)
|
|
{
|
|
if (IncludeInactive)
|
|
{
|
|
|
|
var employees = await _context.ProjectAllocations.Where(c => c.TenantId == TenantId && c.ProjectId == ProjectId).Include(e => e.Employee).ToListAsync();
|
|
|
|
return employees;
|
|
}
|
|
else
|
|
{
|
|
var employees = await _context.ProjectAllocations.Where(c => c.TenantId == TenantId && c.ProjectId == ProjectId && c.IsActive == true).Include(e => e.Employee).ToListAsync();
|
|
|
|
return employees;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|