public ApplicationServiceResult<ClienteEntity> Inserir(ApplicationServiceParam<ClienteEntity> param)
        {
            if (param == null) throw new ArgumentNullException(nameof(param));

            var entity = param.DataParam;

            ApplicationServiceResult<ClienteEntity> result
                 = new ApplicationServiceResult<ClienteEntity>(entity);
            try
            {
                using (var transacao = new TransactionScope())
                {
                    

                    _clienteService.Insert(entity);

                    transacao.Complete();
                }
            }
            catch (Exception)
            {
                //Log in future

                result.AddMessage(Messages.UnexpectedError);

                //Aqui o result.Success está false
            }

            return result;
        }
예제 #2
0
        public ApplicationServiceResult <ClienteEntity> Inserir(ApplicationServiceParam <ClienteEntity> param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }

            var entity = param.DataParam;

            ApplicationServiceResult <ClienteEntity> result
                = new ApplicationServiceResult <ClienteEntity>(entity);

            try
            {
                using (var transacao = new TransactionScope())
                {
                    _clienteService.Insert(entity);

                    transacao.Complete();
                }
            }
            catch (Exception)
            {
                //Log in future

                result.AddMessage(Messages.UnexpectedError);

                //Aqui o result.Success está false
            }

            return(result);
        }