Esempio n. 1
0
        private string GetUrlForRequest <CarSearchParams>()
        {
            string url = BasicUrl;

            InputDataValidator.ValidateInputData(searchParams.Make, searchParams.Model, searchParams.YearStart, searchParams.YearEnd);

            if (!(searchParams.Make is null))
            {
                var make = searchParams.Make.Trim();
                //var make = Enums.OnlinerBrands.;
                url = url + "/" + searchParams.Make;
                if (!(searchParams.Model is null))
                {
                    url = url + "/" + searchParams.Model;
                }
            }
            if (!(searchParams.YearStart == 0))
            {
                url = AddParameterToUrl(url, "year%5Bfrom%5D=", searchParams.YearStart);
            }
            if (!(searchParams.YearEnd == 0))
            {
                url = AddParameterToUrl(url, "year%5Bto%5D=", searchParams.YearEnd);
            }
            if (!(searchParams.EngineType is null))
            {
                url = AddParameterToUrl(url, "engine_type%5B0%5D=", searchParams.EngineType);
            }
            return(url);
        }
Esempio n. 2
0
        private string GetUrlForRequest <CarSearchParams>()
        {
            string url = BasicUrl;

            InputDataValidator.ValidateInputData(searchParams.Make, searchParams.Model, searchParams.YearStart, searchParams.YearEnd);

            if (!(searchParams.Make is null))
            {
                url = AddParameterToUrl(url, "marka_id=", searchParams.Make);
                if (!(searchParams.Model is null))
                {
                    url = AddParameterToUrl(url, "model_id=", searchParams.Model);
                }
            }
            if (!(searchParams.YearStart == 0))
            {
                url = AddParameterToUrl(url, "year_from=", searchParams.YearStart);
            }
            if (!(searchParams.YearEnd == 0))
            {
                url = AddParameterToUrl(url, "year_to=", searchParams.YearEnd);
            }
            if (!(searchParams.EngineType is null))
            {
                url = AddParameterToUrl(url, "engine_type_id=", searchParams.EngineType);
            }
            return(url);
        }