Esempio n. 1
0
        ///EDIT METHODS
        /// <summary>
        /// Updates the tariff with the specified id.  A whole tariff object, including child tariffband objects should be provided, these will be updated to.
        /// NB you cannot included new tariffbands when updating a tariff - create a new band seperately first.
        /// </summary>
        /// <param name="tariffId">id of tariff object to update</param>
        /// <param name="newTariff">tariff object with updated details & tariffbands</param>
        /// <returns>JSON representation of updated Tariff object, including TariffBands, wrapped in EMResponse</returns>
        public string editTariff(int tariffId, string newTariff)
        {
            EMResponse response = new EMResponse();
            try
            {
                tariffMgr = new TariffManager();
                tariffMgr.editTariff(tariffId, newTariff);
                response.status = ok;
            }
            catch (Exception e)
            {
                response.status = error;
                response.data = e.Message;
            }

            return EMConverter.fromObjectToJSON(response);
        }