Exemplo n.º 1
0
 public IHttpActionResult Get()
 {
     try
     {
         CoffeeStoreRepository repo = new CoffeeStoreRepository();
         return(Ok(repo.GetCoffees()));
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
Exemplo n.º 2
0
 public IHttpActionResult Get(int id)
 {
     try
     {
         CoffeeStoreRepository repo = new CoffeeStoreRepository();
         if (id > 0)
         {
             Coffee c = repo.GetCoffee(id);
             if (c != null)
             {
                 return(Ok(c));
             }
         }
         return(NotFound());
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }