public Int32 Edit(CAMPANHA item, LOG log, Int32?idAss) { using (DbContextTransaction transaction = Db.Database.BeginTransaction(IsolationLevel.ReadCommitted)) { try { CAMPANHA obj = _baseRepository.GetById(item.CAMP_CD_ID); _baseRepository.Detach(obj); _logRepository.Add(log); _baseRepository.Update(item); transaction.Commit(); return(0); } catch (Exception ex) { transaction.Rollback(); throw ex; } } }
public int Edit(CampanhaViewModel vm) { var Cliente = _rep.GetClienteByIdUsuario(); var obj = _rep.Get(vm.Id); obj.Nome = vm.Nome; obj.DataFinal = vm.DataFinal; obj.DataInicial = vm.DataInicial; obj.Descricao = vm.Descricao; obj.DoadoresPorHora = vm.DoadoresPorHora; BeginTransaction(); _rep.Update(obj); return(Commit()); }