Esempio n. 1
0
        public IActionResult Create([FromBody] CreatePlaceRequest createPlaceRequest)
        {
            logroñoGuide.AddPlaceOfInterest(
                PlaceOfInterest.Create(createPlaceRequest.Name,
                                       Address.Create(createPlaceRequest.Address)));

            return(Ok());
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
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));
 }
Esempio n. 4
0
        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);
 }