Esempio n. 1
0
        public IHttpActionResult Search([FromBody] string query)
        {
            if (String.IsNullOrEmpty(query))
            {
                return(Content(HttpStatusCode.BadRequest, "No search parameters"));
            }

            IEnumerable <Beer> beers = beerRepository.GetByName(query);

            if (beers != null && beers.Any())
            {
                return(Ok(beers));
            }
            else
            {
                return(NotFound());
            }
        }