public DrinkController(IMoneyHandler moneyHandler, ICatalogItemProvider catalogItemProvider, ICoinStoreProvider coinStoreProvider, IDrinkProvider drinkProvider)
        {
            _moneyHandler = moneyHandler;

            _catalogItemProvider = catalogItemProvider;
            _coinStoreProvider   = coinStoreProvider;
            _drinkProvider       = drinkProvider;
        }
        /// <summary>
        /// Get an array containing all drinks stored
        /// </summary>
        /// <returns></returns>
        public DataDrink[] GetDrinks()
        {
            _logger.Log(LogLevel.Info, "Get all drinks");

            try
            {
                IDrinkProvider drinks = ServiceLocator.Current.GetInstance <IDrinkProvider>();
                return(drinks.GetAll().ToArray());
            }
            catch (InvalidOperationException e)
            {
                _logger.Log(LogLevel.Error, e, "Error occured to GetInstance of ILastConsumeProvider");
            }
            catch (ArgumentNullException e)
            {
                _logger.Log(LogLevel.Error, e, "Error occured to retrive data");
            }catch (Exception e)
            {
                _logger.Log(LogLevel.Error, e, "Unexpected error");
            }
            return(null);
        }
        /// <summary>
        /// Set or Update Last consume of a customer
        /// </summary>
        /// <param name="drink"></param>
        /// <param name="uid"></param>
        /// <param name="sugarLevel"></param>
        /// <param name="usedMug"></param>
        public void SetCustomerLastConsume(String drinkName, string uid, int sugarLevel, bool usedMug)
        {
            _logger.Log(LogLevel.Info, $"Set customer : {0} consume history", uid);
            try
            {
                ILastConsumeProvider last  = ServiceLocator.Current.GetInstance <ILastConsumeProvider>();
                IDrinkProvider       drink = ServiceLocator.Current.GetInstance <IDrinkProvider>();

                last.CreateOrUpdateConsume(drinkName, uid, sugarLevel, usedMug);
            }
            catch (InvalidOperationException e)
            {
                _logger.Log(LogLevel.Error, e, "Error occured to GetInstance of ILastConsumeProvider");
            }
            catch (ArgumentNullException e)
            {
                _logger.Log(LogLevel.Error, e, "Error occured to create data");
            }
            catch (Exception e)
            {
                _logger.Log(LogLevel.Error, e, "Unexpected error");
            }
        }
 public MoneyHandler(ICatalogItemProvider catalogItemProvider, ICoinStoreProvider coinStoreProvider, IDrinkProvider drinkProvider)
 {
     _catalogItemProvider = catalogItemProvider;
     _coinStoreProvider   = coinStoreProvider;
     _drinkProvider       = drinkProvider;
 }