From 4630b54fd2929a081854d11c05f3ed19d919bcf7 Mon Sep 17 00:00:00 2001 From: Ryan Peters Date: Thu, 15 Oct 2020 08:48:11 -0400 Subject: [PATCH] before adding COA packages --- .../COA.EnterpriseServices.Creditors.csproj | 1 + .../CreditorController.cs | 27 +++++++++++++++++++ .../CreditorLibrary.cs | 7 +++-- ...Services.DataAccess.EntityFramework.csproj | 1 - .../COA.EnterpriseServices.DataAccess.csproj | 1 + .../Helpers/CreditorHelper.cs | 13 +++++++++ .../MappingProfile.cs | 12 +++++++++ .../COA.EnterpriseServices.Sandbox.csproj | 2 +- COA.EnterpriseServices.Sandbox/Program.cs | 2 +- COA.EnterpriseServices.sln | 2 +- 10 files changed, 60 insertions(+), 8 deletions(-) rename COA.EnterpriseServices.Creditor/COA.EnterpriseServices.Creditor.csproj => COA.EnterpriseServices.Creditors/COA.EnterpriseServices.Creditors.csproj (80%) create mode 100644 COA.EnterpriseServices.Creditors/CreditorController.cs rename COA.EnterpriseServices.Creditor/CreditorController.cs => COA.EnterpriseServices.Creditors/CreditorLibrary.cs (82%) create mode 100644 COA.EnterpriseServices.DataAccess/MappingProfile.cs diff --git a/COA.EnterpriseServices.Creditor/COA.EnterpriseServices.Creditor.csproj b/COA.EnterpriseServices.Creditors/COA.EnterpriseServices.Creditors.csproj similarity index 80% rename from COA.EnterpriseServices.Creditor/COA.EnterpriseServices.Creditor.csproj rename to COA.EnterpriseServices.Creditors/COA.EnterpriseServices.Creditors.csproj index da7db72..2a1a83b 100644 --- a/COA.EnterpriseServices.Creditor/COA.EnterpriseServices.Creditor.csproj +++ b/COA.EnterpriseServices.Creditors/COA.EnterpriseServices.Creditors.csproj @@ -2,6 +2,7 @@ netcoreapp3.1 + COA.EnterpriseServices.Creditors diff --git a/COA.EnterpriseServices.Creditors/CreditorController.cs b/COA.EnterpriseServices.Creditors/CreditorController.cs new file mode 100644 index 0000000..acf1d8a --- /dev/null +++ b/COA.EnterpriseServices.Creditors/CreditorController.cs @@ -0,0 +1,27 @@ +namespace COA.EnterpriseServices.Creditors +{ + public class CreditorController + { + private readonly CreditorLibrary creditorLibrary; + + public CreditorController(CreditorLibrary creditorLibrary) + { + this.creditorLibrary = creditorLibrary; + } + + public string GetCreditorStatus(int creditorId) + { + return creditorLibrary.GetCreditorStatus(creditorId); + } + + public bool SetCreditorStatus(int creditorId, string status) + { + return creditorLibrary.SetCreditorStatus(creditorId, status); + } + + public void AddOfferResponse() + { + creditorLibrary.AddOfferResponse(); + } + } +} diff --git a/COA.EnterpriseServices.Creditor/CreditorController.cs b/COA.EnterpriseServices.Creditors/CreditorLibrary.cs similarity index 82% rename from COA.EnterpriseServices.Creditor/CreditorController.cs rename to COA.EnterpriseServices.Creditors/CreditorLibrary.cs index c8e283d..163519f 100644 --- a/COA.EnterpriseServices.Creditor/CreditorController.cs +++ b/COA.EnterpriseServices.Creditors/CreditorLibrary.cs @@ -1,13 +1,12 @@ using COA.EnterpriseServices.DataAccess.Helpers; -using System; -namespace COA.EnterpriseServices.Creditor +namespace COA.EnterpriseServices.Creditors { - public class CreditorController + public class CreditorLibrary { private readonly CreditorHelper creditorHelper; - public CreditorController(CreditorHelper creditorHelper) + public CreditorLibrary(CreditorHelper creditorHelper) { this.creditorHelper = creditorHelper; } diff --git a/COA.EnterpriseServices.DataAccess.EntityFramework/COA.EnterpriseServices.DataAccess.EntityFramework.csproj b/COA.EnterpriseServices.DataAccess.EntityFramework/COA.EnterpriseServices.DataAccess.EntityFramework.csproj index 94606da..ce4bb4a 100644 --- a/COA.EnterpriseServices.DataAccess.EntityFramework/COA.EnterpriseServices.DataAccess.EntityFramework.csproj +++ b/COA.EnterpriseServices.DataAccess.EntityFramework/COA.EnterpriseServices.DataAccess.EntityFramework.csproj @@ -5,7 +5,6 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/COA.EnterpriseServices.DataAccess/COA.EnterpriseServices.DataAccess.csproj b/COA.EnterpriseServices.DataAccess/COA.EnterpriseServices.DataAccess.csproj index 9cfacb7..9d6b8d4 100644 --- a/COA.EnterpriseServices.DataAccess/COA.EnterpriseServices.DataAccess.csproj +++ b/COA.EnterpriseServices.DataAccess/COA.EnterpriseServices.DataAccess.csproj @@ -5,6 +5,7 @@ + diff --git a/COA.EnterpriseServices.DataAccess/Helpers/CreditorHelper.cs b/COA.EnterpriseServices.DataAccess/Helpers/CreditorHelper.cs index f4ffe4d..79d59f2 100644 --- a/COA.EnterpriseServices.DataAccess/Helpers/CreditorHelper.cs +++ b/COA.EnterpriseServices.DataAccess/Helpers/CreditorHelper.cs @@ -26,19 +26,32 @@ namespace COA.EnterpriseServices.DataAccess.Helpers public ICollection FindByName(string name) { + // TODO: use AutoMapper to return mapped domain objects! + return creditorDataAccess.Get(c => c.ClientFirstName.Contains(name) || c.ClientLastName.Contains(name)); } public ICollection FindByStatus(string status) { + // TODO: use AutoMapper to return mapped domain objects! + return creditorDataAccess.Get(c => c.Status == status); } public bool AddCreditor(Creditor creditor) { + // TODO: use AutoMapper to pass in mapped domain object! + return creditorDataAccess.Add(creditor); } + public bool UpdateCreditor(Creditor creditor) + { + // TODO: use AutoMapper to pass in mapped domain object! + + return creditorDataAccess.Update(creditor); + } + public bool SetCreditorStatus(int creditorId, string status) { return creditorDataAccess.Update(creditorId, c => c.Status = status); diff --git a/COA.EnterpriseServices.DataAccess/MappingProfile.cs b/COA.EnterpriseServices.DataAccess/MappingProfile.cs new file mode 100644 index 0000000..3a9a81c --- /dev/null +++ b/COA.EnterpriseServices.DataAccess/MappingProfile.cs @@ -0,0 +1,12 @@ +using AutoMapper; + +namespace COA.EnterpriseServices.DataAccess +{ + public class MappingProfile : Profile + { + public MappingProfile() + { + // add mappings between domain and entity objects here + } + } +} diff --git a/COA.EnterpriseServices.Sandbox/COA.EnterpriseServices.Sandbox.csproj b/COA.EnterpriseServices.Sandbox/COA.EnterpriseServices.Sandbox.csproj index f1f97c1..2c5ddf3 100644 --- a/COA.EnterpriseServices.Sandbox/COA.EnterpriseServices.Sandbox.csproj +++ b/COA.EnterpriseServices.Sandbox/COA.EnterpriseServices.Sandbox.csproj @@ -6,7 +6,7 @@ - + diff --git a/COA.EnterpriseServices.Sandbox/Program.cs b/COA.EnterpriseServices.Sandbox/Program.cs index 57a2def..d7715c0 100644 --- a/COA.EnterpriseServices.Sandbox/Program.cs +++ b/COA.EnterpriseServices.Sandbox/Program.cs @@ -1,4 +1,4 @@ -using COA.EnterpriseServices.Creditor; +using COA.EnterpriseServices.Creditors; using COA.EnterpriseServices.DataAccess; using System; using System.Runtime.CompilerServices; diff --git a/COA.EnterpriseServices.sln b/COA.EnterpriseServices.sln index 2b78fac..00ae297 100644 --- a/COA.EnterpriseServices.sln +++ b/COA.EnterpriseServices.sln @@ -11,7 +11,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "COA.EnterpriseServices.Data EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "COA.EnterpriseServices.Sandbox", "COA.EnterpriseServices.Sandbox\COA.EnterpriseServices.Sandbox.csproj", "{61BE21F9-8C5B-4C99-885A-E0B1E5BDCA79}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "COA.EnterpriseServices.Creditor", "COA.EnterpriseServices.Creditor\COA.EnterpriseServices.Creditor.csproj", "{FD33DD45-C0B9-45EE-B4C9-43CF1E6AB383}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "COA.EnterpriseServices.Creditors", "COA.EnterpriseServices.Creditors\COA.EnterpriseServices.Creditors.csproj", "{FD33DD45-C0B9-45EE-B4C9-43CF1E6AB383}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution