Example #1
0
        static void UpdateValores()
        {
            ValorRepository valorRepository = new ValorRepository();

            // Controlo que no haya valores cargados previamente para que no explote o genere datos repetidos.
            var valores = valorRepository.GetAll();

            if (valores.Count == 0)
            {
                Console.WriteLine("No hay valores a editar");
            }
            else
            {
                valores[0].Nombre     = "Bajos";
                valores[0].Influencia = 0;
                valorRepository.Update(valores[0]);

                valores[1].Nombre     = "Medios";
                valores[2].Influencia = 1;
                valorRepository.Update(valores[1]);

                valores[2].Nombre     = "Altos";
                valores[2].Influencia = 2;
                valorRepository.Update(valores[2]);
            }
        }
Example #2
0
 public void Edit(ValorDTO entity)
 {
     try
     {
         var isValid = Validate(entity);
         if (string.IsNullOrEmpty(isValid))
         {
             Valor f = DTOaValor(entity);
             _valor = f;
             _valorRepository.Update(_valor);
         }
         else
         {
             _log.WriteLog(isValid);
             throw new Exception(isValid);
         }
     }
     catch (Exception e)
     {
         _log.WriteLog(e.ToString());
     }
 }