예제 #1
0
        public static void Delete(Empresa empresa)
        {
            EmpresaEntity entity;

            entity = EmpresaMapper.Get(empresa);

            EmpresaDao.Delete(entity);
        }
예제 #2
0
        public static int Add(Empresa item)
        {
            EmpresaEntity entity;

            entity  = EmpresaMapper.Get(item);
            item.Id = EmpresaDao.Add(entity);

            return(item.Id);
        }
예제 #3
0
        public static Empresa Get(int id)
        {
            Empresa       item;
            EmpresaEntity entity;

            entity = EmpresaDao.Get(id);
            item   = EmpresaMapper.Get(entity);

            return(item);
        }
예제 #4
0
        public static List <Empresa> GetAll()
        {
            try
            {
                List <Empresa>       lista;
                List <EmpresaEntity> entities;

                entities = EmpresaDao.GetAll();
                lista    = EmpresaMapper.GetAll(entities);

                return(lista);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #5
0
        public static void Update(EmpresaDto empresaDto)
        {
            try
            {
                Empresa entity;

                entity = EmpresaMapper.Get(empresaDto);
                using (var db = new AppDbContext())
                {
                    db.Entry(entity).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                    db.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #6
0
        public static void Add(EmpresaDto empresa)
        {
            try
            {
                Empresa entity;

                entity = EmpresaMapper.Get(empresa);
                using (var db = new AppDbContext())
                {
                    db.Empresa.Add(entity);
                    db.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #7
0
        public static void Delete(EmpresaDto empresaDto)
        {
            try
            {
                Empresa entity;

                entity             = EmpresaMapper.Get(empresaDto);
                entity.IsActivo    = false;
                entity.FechaDeBaja = DateTime.Now;
                using (var db = new AppDbContext())
                {
                    db.Entry(entity).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                    db.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #8
0
        public static List <EmpresaDto> GetAll(bool isActivo = true)
        {
            try
            {
                List <EmpresaDto> lista;
                List <Empresa>    entities;

                using (var db = new AppDbContext())
                {
                    entities = db.Empresa.Where(x => x.IsActivo == isActivo).ToList();
                    lista    = EmpresaMapper.GetAll(entities);
                }

                return(lista);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #9
0
 public EmpresaServicio()
 {
     mapper = new EmpresaMapper();
 }
        public async Task <EmpresaModel> Get(int id)
        {
            var entity = await _IEMPRESARepository.Get(id);

            return(EmpresaMapper.Map(entity));
        }
        public async Task <EmpresaModel> Add(EmpresaModel empresaModel)
        {
            var entity = await _IEMPRESARepository.Add(EmpresaMapper.Map(empresaModel));

            return(EmpresaMapper.Map(entity));
        }
예제 #12
0
 public EmpresaCrudFactory() : base()
 {
     mapper = new EmpresaMapper();
     dao    = SqlDao.GetInstance();
 }
예제 #13
0
 public EmpresaCrudFactory()
 {
     _mapper = new EmpresaMapper();
 }