From 1a1f7ff0a4c5f7157e13f7239313e779f8be93c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miskolczi=20Rich=C3=A1rd?= Date: Wed, 22 Nov 2023 14:01:22 +0100 Subject: [PATCH] Creating LoginServices with queries inside --- WD7UVN_HFT_2023241.Logic/Class1.cs | 8 ---- WD7UVN_HFT_2023241.Logic/LogicServices.cs | 45 +++++++++++++++++++++++ 2 files changed, 45 insertions(+), 8 deletions(-) delete mode 100644 WD7UVN_HFT_2023241.Logic/Class1.cs create mode 100644 WD7UVN_HFT_2023241.Logic/LogicServices.cs 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; + } + } +}