예제 #1
0
        public static void ModificarFuente(Fuente fuente)
        {
            int resultado = 0;

            if (fuente is Periodista)
            {
                ValidarPeriodista(fuente);
                resultado = PersistenciaPeriodista.ModificarPeriodista((Periodista)fuente);
                if (resultado == -1)
                {
                    throw new ExcepcionLogica("No se encontró un periodista con ese identificador.");
                }
            }
            else if (fuente is Agencia)
            {
                ValidarAgencia(fuente);
                resultado = PersistenciaAgencia.ModificarAgencia((Agencia)fuente);
                if (resultado == -1)
                {
                    throw new ExcepcionLogica("No se encontró una Agencia con ese identificador.");
                }
            }
            else
            {
                throw new ExcepcionLogica("Tipo de Fuente no reconocido.");
            }
        }