Example #1
0
        public HttpResponseMessage InsertarCiudad(DTOCiudad dto)
        {
            try
            {
                Console.WriteLine(dto);
                TraductorCiudad      traductor = FabricaTraductor.CrearTraductorCiudad( );
                Entidad              ciudad    = traductor.CrearEntidad(dto);
                ComandoAgregarCiudad comando   = FabricaComando.CrearComandoAgregarCiudad(ciudad);
                comando.Ejecutar( );
                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (NpgsqlException e)
            {
                logger.Error(e, e.Message);

                throw new BaseDeDatosException(e, "Error en la base de datos en: " + GetType( ).FullName + "." + MethodBase.GetCurrentMethod( ).Name + ". " + e.Message);
            }

            catch (Exception e)
            {
                logger.Error(e, e.Message);

                throw new ExcepcionGeneral(e, DateTime.Now);
            }
        }
Example #2
0
        public IHttpActionResult InsertarCiudadid(DTOCiudadNombre dto)
        {
            try
            {
                System.Diagnostics.Debug.WriteLine(dto);
                TraductorCiudadNombre traductor = FabricaTraductor.CrearTraductorCiudadNombre( );
                Entidad ciudad = traductor.CrearEntidad(dto);
                ComandoAgregarCiudad comando = FabricaComando.CrearComandoAgregarCiudad(ciudad);
                comando.Ejecutar( );
                return(Ok( ));
            }
            catch (NpgsqlException e)
            {
                logger.Error(e, e.Message);

                throw new BaseDeDatosException(e, "Error en la base de datos en: " + GetType( ).FullName + "." + MethodBase.GetCurrentMethod( ).Name + ". " + e.Message);
            }

            catch (Exception e)
            {
                logger.Error(e, e.Message);

                throw new ExcepcionGeneral(e, DateTime.Now);
            }
        }