Ejemplo n.º 1
0
        public FindResponseCountry Find(int id)
        {
            try
            {
                var response = new FindResponseCountry();
                var bc       = new CountryBusiness();
                response.Result = bc.Find(id);
                return(response);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
        public FindResponse <Country> Find(int id)
        {
            logger.Info($"Inicio de la busqueda de la categoria con id {id}");
            try
            {
                var response = new FindResponse <Country>();
                response.Result = countryBusiness.Find(id);
                return(response);
            }
            catch (Exception ex)
            {
                logger.Error($"Error al obtener la categoria {id}", ex);
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }