public IActionResult Create([FromBody] CreatePlaceRequest createPlaceRequest) { logroƱoGuide.AddPlaceOfInterest( PlaceOfInterest.Create(createPlaceRequest.Name, Address.Create(createPlaceRequest.Address))); return(Ok()); }
public static bool MatchesSearch(this PlaceOfInterest placeOfInterest, string search) { //Temporal check until constraint is enabled in controller if (search == null) { search = string.Empty; } return(placeOfInterest.Name.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) >= 0 || placeOfInterest.Address.AddressLine.IndexOf(search, StringComparison.InvariantCulture) >= 0); }
public bool Equals(PlaceOfInterest place) { if (ReferenceEquals(place, null)) { return(false); } if (this.GetType() != place.GetType()) { return(false); } return((Name == place.Name) && (Adress == place.Adress) && (Year == place.Year)); }
public static bool Search(this PlaceOfInterest placeOfInterest, string search) { var words = search.Split(" ").Where(w => w.Length > 3); bool match = false; foreach (var word in words) { if (match) { break; } match = MatchesSearch(placeOfInterest, word); } return(match); }
public void AddPlaceOfInterest(PlaceOfInterest place) { placesOfInterest.Add(place); }