Ejemplo n.º 1
0
        public bool Delete(DesCant item, Session session = null)
        {
            //LoggerFactory.CreateLog().Start();
            var committed = 0;

            try
            {
                //if (session != null)
                //    _repositoryDesCant.UnitOfWork.SetConnectionDb(session.ConnectionString);

                if (item == null)
                {
                    throw new ArgumentNullException("item");
                }

                // Domain Services?
                //_repositoryDesCant.Delete(Mapper.Map<Dominio.Entidades.DesCant>(item));
                _repositoryDesCant.Delete(item);
                committed = _unitOfWorkAsync.SaveChanges();
            }
            catch (Exception ex)
            {
                //LoggerFactory.CreateLog().Error(ex);
            }

            //LoggerFactory.CreateLog().Stop();
            return(committed > 0);
        }
Ejemplo n.º 2
0
        public bool Update(DesCant item, Session session = null)
        {
            //LoggerFactory.CreateLog().Start();
            var committed = 0;

            try
            {
                //if (session != null)
                //    _repositoryDesCant.UnitOfWork.SetConnectionDb(session.ConnectionString);

                if (item == null)
                {
                    throw new ArgumentNullException("item");
                }

                var validator = EntityValidatorFactory.CreateValidator();
                if (validator.IsValid(item))
                {
                    // Domain Services?
                    //_repositoryDesCant.Update(Mapper.Map<Dominio.Entidades.DesCant>(item));
                    _repositoryDesCant.Update(item);
                    committed = _unitOfWorkAsync.SaveChanges();
                }
                else
                {
                    throw new ApplicationValidationErrorsException(validator.GetInvalidMessages(item));
                }
            }
            catch (Exception ex)
            {
                //LoggerFactory.CreateLog().Error(ex);
            }

            //LoggerFactory.CreateLog().Stop();
            //_repositoryDesCant.Update(entity);
            return(committed > 0);
        }
Ejemplo n.º 3
0
 public DesCantCrudViewModel()
 {
     DesCant = new DesCant();
 }
Ejemplo n.º 4
0
 public void ApplyChanges(DesCant entity)
 {
     _repositoryDesCant.ApplyChanges(entity);
 }