Adding two more non-crud queries
This commit is contained in:
@@ -13,6 +13,8 @@ namespace WD7UVN_HFT_2023241.Logic
|
||||
public IQueryable<Employee> WhoWorksInMaintainerTeam(int maintainerTeamId);
|
||||
public IQueryable<Employee> GetSubordinates(int managerId);
|
||||
public IQueryable<Customer> WhoUsesService(int serviceId);
|
||||
public Employee WhoIsResponsibleForService(int serviceId);
|
||||
public IQueryable<Employee> WhoMaintainsService(int serviceId);
|
||||
}
|
||||
|
||||
public class LogicServices : ILogicServices
|
||||
@@ -24,7 +26,30 @@ namespace WD7UVN_HFT_2023241.Logic
|
||||
this.CRUDOperations = CRUDOperations;
|
||||
}
|
||||
|
||||
public IQueryable<Employee> WhoWorksInMaintainerTeam(int maintainerTeamId)
|
||||
public IQueryable<Employee> WhoMaintainsService(int serviceId)
|
||||
{
|
||||
IQueryable<Employee> query =
|
||||
from employee in CRUDOperations.ReadAllEmployees()
|
||||
join service in CRUDOperations.ReadAllServices() on employee.MAINTAINER_ID equals service.MAINTAINER_ID
|
||||
where service.ID == serviceId
|
||||
select employee;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
public Employee WhoIsResponsibleForService(int serviceId)
|
||||
{
|
||||
var query =
|
||||
from service in CRUDOperations.ReadAllServices()
|
||||
join team in CRUDOperations.ReadAllMaintainerTeams() on service.MAINTAINER_ID equals team.ID
|
||||
join employee in CRUDOperations.ReadAllEmployees() on team.LEADER_ID equals employee.ID
|
||||
where service.ID == serviceId
|
||||
select employee;
|
||||
|
||||
return query.FirstOrDefault();
|
||||
}
|
||||
|
||||
public IQueryable<Employee> WhoWorksInMaintainerTeam(int maintainerTeamId)
|
||||
{
|
||||
return CRUDOperations
|
||||
.ReadAllEmployees()
|
||||
|
||||
Reference in New Issue
Block a user