Beispiel #1
0
        /// <summary>
        /// Valida el NIF de un usuario y devuelve cierto si es correcto o falso si no lo es - /Utilidades/validarNIF
        /// </summary>
        /// <param name="getutilidadesvalidarnifquery">query properties</param>
        public virtual async Task <practica1.Utilidades.Models.UtilidadesValidarNIFGetResponse> Get(practica1.Utilidades.Models.GetUtilidadesValidarNIFQuery getutilidadesvalidarnifquery)
        {
            var url = "/Utilidades/validarNIF";

            if (getutilidadesvalidarnifquery != null)
            {
                url += "?";
                if (getutilidadesvalidarnifquery.DNI != null)
                {
                    url += "&DNI=" + Uri.EscapeDataString(getutilidadesvalidarnifquery.DNI);
                }
                if (getutilidadesvalidarnifquery.RestKey != null)
                {
                    url += "&RestKey=" + Uri.EscapeDataString(getutilidadesvalidarnifquery.RestKey);
                }
            }

            url = url.Replace("?&", "?");

            var req      = new HttpRequestMessage(HttpMethod.Get, url.StartsWith("/") ? url.Substring(1) : url);
            var response = await proxy.Client.SendAsync(req);

            var headers = new practica1.Utilidades.Models.GetUtilidadesValidarNIFOKResponseHeader();

            headers.SetProperties(response.Headers);
            return(new practica1.Utilidades.Models.UtilidadesValidarNIFGetResponse
            {
                RawContent = response.Content,
                Headers = headers,
                RawHeaders = response.Headers,
                StatusCode = response.StatusCode,
                ReasonPhrase = response.ReasonPhrase,
                SchemaValidation = new Lazy <SchemaValidationResults>(() => new SchemaValidationResults(true), true)
            });
        }
Beispiel #2
0
        /// <summary>
        /// Valida el NIF de un usuario y devuelve cierto si es correcto o falso si no lo es - /Utilidades/validarNIF
        /// </summary>
        /// <param name="request">practica1.Utilidades.Models.UtilidadesValidarNIFGetRequest</param>
        /// <param name="responseFormatters">response formatters</param>
        public virtual async Task <practica1.Utilidades.Models.UtilidadesValidarNIFGetResponse> Get(practica1.Utilidades.Models.UtilidadesValidarNIFGetRequest request, IEnumerable <MediaTypeFormatter> responseFormatters = null)
        {
            var url = "/Utilidades/validarNIF";

            if (request.Query != null)
            {
                url += "?";
                if (request.Query.DNI != null)
                {
                    url += "&DNI=" + Uri.EscapeDataString(request.Query.DNI);
                }
                if (request.Query.RestKey != null)
                {
                    url += "&RestKey=" + Uri.EscapeDataString(request.Query.RestKey);
                }
            }

            url = url.Replace("?&", "?");

            var req = new HttpRequestMessage(HttpMethod.Get, url.StartsWith("/") ? url.Substring(1) : url);

            if (request.Headers != null)
            {
                foreach (var header in request.Headers.Headers)
                {
                    req.Headers.TryAddWithoutValidation(header.Key, header.Value);
                }
            }
            if (request.RawHeaders != null)
            {
                foreach (var header in request.RawHeaders)
                {
                    req.Headers.TryAddWithoutValidation(header.Key, string.Join(",", header.Value));
                }
            }
            var response = await proxy.Client.SendAsync(req);

            var headers = new practica1.Utilidades.Models.GetUtilidadesValidarNIFOKResponseHeader();

            headers.SetProperties(response.Headers);
            return(new practica1.Utilidades.Models.UtilidadesValidarNIFGetResponse
            {
                RawContent = response.Content,
                Headers = headers,
                RawHeaders = response.Headers,
                Formatters = responseFormatters,
                StatusCode = response.StatusCode,
                ReasonPhrase = response.ReasonPhrase,
                SchemaValidation = new Lazy <SchemaValidationResults>(() => new SchemaValidationResults(true), true)
            });
        }