summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/SocioRepository.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/SocioRepository.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/SocioRepository.cs')
-rw-r--r--Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/SocioRepository.cs75
1 files changed, 75 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/SocioRepository.cs b/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/SocioRepository.cs
new file mode 100644
index 0000000..0bacb70
--- /dev/null
+++ b/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Logic/SocioRepository.cs
@@ -0,0 +1,75 @@
+using AutoMapper;
+using Gestor.Infrastructure.Entities.Common;
+using Gestor.Infrastructure.Entities.Generic;
+using Gestor.Infrastructure.Mappers;
+using Gestor.Infrastructure.Repository.Generic;
+using Gestor.Infrastructure.Repository.Interface;
+using Gestor.Infrastructure.UnitOfWork.Generic;
+using Gestor.Model.Domain.Common;
+using NHibernate;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Runtime.CompilerServices;
+
+namespace Gestor.Infrastructure.Repository.Logic
+{
+ public class SocioRepository : GenericRepository<SocioDb>, ISocioRepository, IGenericRepository<SocioDb>
+ {
+ private readonly GenericUnitOfWork _unitOfWork;
+
+ public SocioRepository(GenericUnitOfWork unitOfWork) : base(unitOfWork.Session)
+ {
+ this._unitOfWork = unitOfWork;
+ }
+
+ public void Delete(long id)
+ {
+ base.Delete(base.FindEntityById(id));
+ }
+
+ public List<Socio> Find()
+ {
+ return (
+ from x in base.All()
+ select new Socio()
+ {
+ Id = x.Id,
+ Nome = x.Nome,
+ Email = x.Email,
+ Prefixo = x.Prefixo,
+ Telefone = x.Telefone
+ }).ToList<Socio>();
+ }
+
+ public List<Socio> FindByEmpresa(long id)
+ {
+ List<SocioDb> list = (
+ from x in this._unitOfWork.Session.CreateQuery("FROM SocioDb WHERE (excluido IS NULL OR excluido != '1')").List<SocioDb>()
+ where x.IdEmpresa == id
+ select x).ToList<SocioDb>();
+ return ApplicationMapper.Mapper.Map<List<SocioDb>, List<Socio>>(list);
+ }
+
+ public Socio FindById(long id)
+ {
+ SocioDb socioDb = base.FindEntityById(id);
+ return ApplicationMapper.Mapper.Map<SocioDb, Socio>(socioDb);
+ }
+
+ public Socio Merge(Socio socio)
+ {
+ SocioDb socioDb = ApplicationMapper.Mapper.Map<Socio, SocioDb>(socio);
+ base.Merge(socioDb);
+ return ApplicationMapper.Mapper.Map<SocioDb, Socio>(socioDb);
+ }
+
+ public Socio SaveOrUpdate(Socio socio)
+ {
+ SocioDb socioDb = ApplicationMapper.Mapper.Map<Socio, SocioDb>(socio);
+ this.SaveOrUpdate(socioDb);
+ return ApplicationMapper.Mapper.Map<SocioDb, Socio>(socioDb);
+ }
+ }
+} \ No newline at end of file