From f837f446b916e9c3f67509b0d989f050088729eb Mon Sep 17 00:00:00 2001 From: dmolinari Date: Fri, 20 Mar 2026 13:39:11 -0300 Subject: [PATCH] Fix: Filtros ExplorarPage --- .../Controllers/AdsV2Controller.cs | 11 ++++++++--- Frontend/src/pages/ExplorarPage.tsx | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Backend/MotoresArgentinosV2.API/Controllers/AdsV2Controller.cs b/Backend/MotoresArgentinosV2.API/Controllers/AdsV2Controller.cs index fff185e..55acadf 100644 --- a/Backend/MotoresArgentinosV2.API/Controllers/AdsV2Controller.cs +++ b/Backend/MotoresArgentinosV2.API/Controllers/AdsV2Controller.cs @@ -79,7 +79,12 @@ public class AdsV2Controller : ControllerBase query = query.Where(a => a.Transmission == transmission || a.Features.Any(f => f.FeatureKey == "Transmision" && f.FeatureValue == transmission)); if (!string.IsNullOrEmpty(color)) - query = query.Where(a => a.Color == color || a.Features.Any(f => f.FeatureKey == "Color" && f.FeatureValue == color)); + { + var lowerColor = color.ToLower(); + query = query.Where(a => + (a.Color != null && a.Color.ToLower().Contains(lowerColor)) || + a.Features.Any(f => f.FeatureKey == "Color" && f.FeatureValue != null && f.FeatureValue.ToLower().Contains(lowerColor))); + } if (!string.IsNullOrEmpty(Request.Query["segment"])) { @@ -88,8 +93,8 @@ public class AdsV2Controller : ControllerBase } if (!string.IsNullOrEmpty(Request.Query["location"])) { - var loc = Request.Query["location"].ToString(); - query = query.Where(a => a.Location != null && a.Location.Contains(loc)); + var loc = Request.Query["location"].ToString().ToLower(); + query = query.Where(a => a.Location != null && a.Location.ToLower().Contains(loc)); } if (!string.IsNullOrEmpty(Request.Query["condition"])) { diff --git a/Frontend/src/pages/ExplorarPage.tsx b/Frontend/src/pages/ExplorarPage.tsx index 601bcc1..7c8eca9 100644 --- a/Frontend/src/pages/ExplorarPage.tsx +++ b/Frontend/src/pages/ExplorarPage.tsx @@ -75,6 +75,12 @@ export default function ExplorarPage() { modelId: modelId ? Number(modelId) : undefined, fuel: fuel || undefined, transmission: transmission || undefined, + color: searchParams.get("color") || undefined, + location: searchParams.get("location") || undefined, + condition: searchParams.get("condition") || undefined, + segment: searchParams.get("segment") || undefined, + doorCount: searchParams.get("doorCount") ? Number(searchParams.get("doorCount")) : undefined, + steering: searchParams.get("steering") || undefined, }); setListings(data); } catch (err) {