Beispiel #1
0
 public IHttpActionResult Add([FromBody] Beer beer)
 {
     if (Beer.IsValid(beer) && beerRepository.Add(beer))
     {
         return(Ok());
     }
     else
     {
         return(Content(HttpStatusCode.BadRequest, ""));
     }
 }
Beispiel #2
0
        public IHttpActionResult Update([FromBody] Beer beer)
        {
            if (Beer.IsValid(beer))
            {
                Beer updatedBeer = beerRepository.Update(beer);

                if (updatedBeer != null)
                {
                    return(Ok(updatedBeer));
                }
                else
                {
                    return(Content(HttpStatusCode.BadRequest, ""));
                }
            }
            else
            {
                return(Content(HttpStatusCode.BadRequest, ""));
            }
        }