Exemple #1
0
        internal ResultAction Post(HistoryProposalDTO historic)
        {
            ResultAction result = new ResultAction();

            using (var scope = new TransactionScope())
            {
                HistoryProposal newHistoric = new HistoryProposal();
                newHistoric.IdUser     = historic.IdUser;
                newHistoric.IdProposal = historic.IdProposal;
                newHistoric.Action     = (ActionHistoric)historic.Action;

                int id = new HistoryProposalService().Post(newHistoric);

                if (id > 0)
                {
                    result.IsOk    = true;
                    result.Result  = id;
                    result.Message = "Ação do usuário salvo com sucesso.";
                }
                else
                {
                    result.Message = "Erro ao salvar a ação do usuário.";
                }

                scope.Complete();
                scope.Dispose();
            }

            return(result);
        }
        private bool CreateHistory(int?idUser, int id, ActionHistoric action)
        {
            HistoryProposalDTO historic = new HistoryProposalDTO
            {
                IdProposal = id,
                IdUser     = idUser,
                Action     = (int)action
            };

            HistoryProposalBusiness business = new HistoryProposalBusiness();
            ResultAction            result   = business.Post(historic);

            return((int)result.Result > 0);
        }