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); }
internal int Post(HistoryProposal historic) { context.Historic.Add(historic); context.SaveChanges(); return(historic.Id); }