diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InsitutionContractAmendmentPaymentResponse.cs b/CompanyManagment.App.Contracts/InstitutionContract/InsitutionContractAmendmentPaymentResponse.cs index f6a90dc4..5b12d501 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/InsitutionContractAmendmentPaymentResponse.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/InsitutionContractAmendmentPaymentResponse.cs @@ -1,11 +1,27 @@ +using System.Collections.Generic; + namespace CompanyManagment.App.Contracts.InstitutionContract; public class InsitutionContractAmendmentPaymentResponse { + public List workshops { get; set; } public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; } public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; } public string ContractStart { get; set; } public string ContractEnd { get; set; } public string OneMonthAmount { get; set; } public string TotalAmount { get; set; } +} + +public class InsitutionContractAmendmentPaymentWorkshopResponse +{ + public WorkshopServicesViewModel OldServices { get; set; } + public WorkshopServicesViewModel NewServices { get; set; } + + public bool IsNewWorkshop { get; set; } + + public int PrevPersonnelCount { get; set; } + public int NewPersonnelCount { get; set; } + + public double Price { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index 8658fece..564c2e66 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -2464,6 +2464,7 @@ public class InstitutionContractRepository : RepositoryBase + { + var prevWorkshop = institutionContractAmendmentTemp.PrevWorkshops + .FirstOrDefault(w=> w.Id == x.Id); + var isNewWorkshop = prevWorkshop == null; + return new InsitutionContractAmendmentPaymentWorkshopResponse() + { + IsNewWorkshop = isNewWorkshop, + NewPersonnelCount = x.CountPerson, + PrevPersonnelCount = prevWorkshop?.CountPerson??0, + Price = x.PriceDifference, + OldServices = prevWorkshop != null? new WorkshopServicesViewModel() + { + Contract = prevWorkshop.ContractAndCheckout, + ContractInPerson = prevWorkshop.ContractAndCheckoutInPerson, + CustomizeCheckout = prevWorkshop.CustomizeCheckout, + Insurance = prevWorkshop.Insurance, + InsuranceInPerson = prevWorkshop.InsuranceInPerson, + RollCall = prevWorkshop.RollCall, + RollCallInPerson = prevWorkshop.RollCallInPerson, + }: new WorkshopServicesViewModel(), + NewServices = new WorkshopServicesViewModel() + { + Contract = x.ContractAndCheckout, + ContractInPerson = x.ContractAndCheckoutInPerson, + CustomizeCheckout = x.CustomizeCheckout, + Insurance = x.Insurance, + InsuranceInPerson = x.InsuranceInPerson, + RollCall = x.RollCall, + RollCallInPerson = x.RollCallInPerson, + }, + }; + }).ToList() }; res.OneTime = new InstitutionContractPaymentOneTimeViewModel()