示例#1
0
        public bool Delete(FactConv item, Session session = null)
        {
            //LoggerFactory.CreateLog().Start();
            var committed = 0;

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

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

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

            //LoggerFactory.CreateLog().Stop();
            return(committed > 0);
        }
示例#2
0
        public bool Update(FactConv item, Session session = null)
        {
            //LoggerFactory.CreateLog().Start();
            var committed = 0;

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

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

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

            //LoggerFactory.CreateLog().Stop();
            //_repositoryFactConv.Update(entity);
            return(committed > 0);
        }
示例#3
0
 public void ApplyChanges(FactConv entity)
 {
     _repositoryFactConv.ApplyChanges(entity);
 }
示例#4
0
 public FactConvCrudViewModel()
 {
     FactConv = new FactConv();
 }