diff --git a/WD7UVN_HFT_2023241.Logic/Class1.cs b/WD7UVN_HFT_2023241.Logic/Class1.cs deleted file mode 100644 index 4313f5c..0000000 --- a/WD7UVN_HFT_2023241.Logic/Class1.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace WD7UVN_HFT_2023241.Logic -{ - public class Class1 - { - } -} diff --git a/WD7UVN_HFT_2023241.Logic/LogicServices.cs b/WD7UVN_HFT_2023241.Logic/LogicServices.cs new file mode 100644 index 0000000..fa5472e --- /dev/null +++ b/WD7UVN_HFT_2023241.Logic/LogicServices.cs @@ -0,0 +1,45 @@ +using System; +using System.Linq; +using WD7UVN_HFT_2023241.Models; +using WD7UVN_HFT_2023241.Repository; + +namespace WD7UVN_HFT_2023241.Logic +{ + public interface ILogicServices + { + public ICRUD CRUDOperations { get; set; } + + //additional, non-CRUD operations + + public IQueryable WhoWorksInMaintainerTeam(int maintainerTeamId) + { + return CRUDOperations + .ReadAllEmployees() + .Where(e => e.MAINTAINER_ID == maintainerTeamId); + } + + public IQueryable GetSubordinates(int managerId) + { + return CRUDOperations + .ReadAllEmployees() + .Where(e => e.MANAGER_ID == managerId); + } + + public IQueryable WhoUsesService(int serviceId) + { + return CRUDOperations + .ReadAllCustomers() + .Where(c => c.SERVICE_ID == serviceId); + } + } + + public class LogicServices : ILogicServices + { + public ICRUD CRUDOperations { get; set; } + + public LogicServices(ICRUD CRUDOperations) + { + this.CRUDOperations = CRUDOperations; + } + } +}