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; } }
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; } }
public Drink ChangeDrink(int drinkId, Drink drinkToChange) { throw new NotImplementedException(); }
public Drink AddDrink(Drink drinkToAdd) { throw new NotImplementedException(); }