From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../ClienteVinculoRepository.cs | 112 --------------------- 1 file changed, 112 deletions(-) delete mode 100644 Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ClienteVinculoRepository.cs (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ClienteVinculoRepository.cs') diff --git a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ClienteVinculoRepository.cs b/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ClienteVinculoRepository.cs deleted file mode 100644 index 460e860..0000000 --- a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/ClienteVinculoRepository.cs +++ /dev/null @@ -1,112 +0,0 @@ -using AutoMapper; -using Gestor.Infrastructure.Entities.Generic; -using Gestor.Infrastructure.Entities.Seguros; -using Gestor.Infrastructure.Mappers; -using Gestor.Infrastructure.Repository.Generic; -using Gestor.Infrastructure.Repository.Interface; -using Gestor.Infrastructure.UnitOfWork.Generic; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Runtime.CompilerServices; - -namespace Gestor.Infrastructure.Repository.Logic -{ - public class ClienteVinculoRepository : GenericRepository, IClienteVinculoRepository, IGenericRepository - { - public ClienteVinculoRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session) - { - } - - public void Delete(long id) - { - base.Delete(base.FindEntityById(id)); - } - - public List DeleteVinculo(long clienteId, List vinculos) - { - if (vinculos == null) - { - return null; - } - List list = ( - from x in base.All() - where x.Cliente1.Id == clienteId || x.Cliente2.Id == clienteId - select x).ToList().Where((ClienteVinculoDb vinculo) => { - List clienteVinculos = vinculos; - Func u003cu003e9_32 = ClienteVinculoRepository.u003cu003ec.u003cu003e9__3_2; - if (u003cu003e9_32 == null) - { - u003cu003e9_32 = (ClienteVinculo t) => t.Id; - ClienteVinculoRepository.u003cu003ec.u003cu003e9__3_2 = u003cu003e9_32; - } - return !clienteVinculos.Select(u003cu003e9_32).Contains(vinculo.Id); - }).ToList(); - ClienteVinculoRepository clienteVinculoRepository = this; - list.ForEach(new Action(clienteVinculoRepository.Delete)); - return ApplicationMapper.Mapper.Map, List>(list); - } - - public List FindByCliente(long id) - { - List list = ( - from x in base.All() - where x.Cliente1.Id == id || x.Cliente2.Id == id - select x).ToList(); - return ApplicationMapper.Mapper.Map, List>(list); - } - - public ClienteVinculo FindById(long id) - { - ClienteVinculoDb clienteVinculoDb = base.FindEntityById(id); - return ApplicationMapper.Mapper.Map(clienteVinculoDb); - } - - public List Inserir(List vinculos, Cliente cliente) - { - foreach (ClienteVinculo vinculo in vinculos) - { - if (vinculo.Cliente1.Id == cliente.Id || vinculo.Cliente1.Id == 0) - { - vinculo.Cliente1 = cliente; - } - else - { - if (vinculo.Cliente2.Id != cliente.Id && vinculo.Cliente2.Id != 0) - { - continue; - } - vinculo.Cliente2 = cliente; - } - } - List clienteVinculoDbs = ApplicationMapper.Mapper.Map, List>(vinculos); - base.AddRange(clienteVinculoDbs); - return ApplicationMapper.Mapper.Map, List>(clienteVinculoDbs); - } - - public List Merge(List vinculos, Cliente cliente) - { - List clienteVinculoDbs = ApplicationMapper.Mapper.Map, List>(vinculos); - clienteVinculoDbs.ForEach((ClienteVinculoDb x) => { - if (x.Id != 0) - { - base.Merge(x); - return; - } - x.Cliente1 = ApplicationMapper.Mapper.Map(cliente); - this.SaveOrUpdate(x); - }); - return ApplicationMapper.Mapper.Map, List>(clienteVinculoDbs); - } - - public ClienteVinculo SaveOrUpdate(ClienteVinculo clienteVinculo) - { - ClienteVinculoDb clienteVinculoDb = ApplicationMapper.Mapper.Map(clienteVinculo); - this.SaveOrUpdate(clienteVinculoDb); - return ApplicationMapper.Mapper.Map(clienteVinculoDb); - } - } -} \ No newline at end of file -- cgit v1.2.3