Ejemplo n.º 1
0
 public Drink AddDrink(Drink drinkToAdd)
 {
     if (!ModelState.IsValid)
     {
         throw new HttpResponseException(HttpStatusCode.BadRequest);
     }
     try
     {
         return _drinkRepository.AddDrink(drinkToAdd);
     }
     catch (Exception ex)
     {
         //handle error gracefully. Have a rollback scenario ready. Log.
         throw;
     }
 }
Ejemplo n.º 2
0
 public Drink ChangeDrink(int drinkId, Drink drinkToChange)
 {
     if (!ModelState.IsValid)
     {
         throw new HttpResponseException(HttpStatusCode.BadRequest);
     }
     try
     {
         if (_drinkRepository.GetDrinkById(drinkId) == null)
         {
             throw new HttpResponseException(HttpStatusCode.NoContent);
         }
         return _drinkRepository.ChangeDrink(drinkId, drinkToChange);
     }
     catch (Exception ex)
     {
         //Handle this gracefully or something. Log.
         throw;
     }
 }
Ejemplo n.º 3
0
 public Drink ChangeDrink(int drinkId, Drink drinkToChange)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 4
0
 public Drink AddDrink(Drink drinkToAdd)
 {
     throw new NotImplementedException();
 }