Esempio n. 1
0
 /// <summary>
 /// Create an individual event fee
 /// </summary>
 /// <param name="eventId">Event id</param>
 /// <param name="eventFee">EventFee object</param>
 /// <returns>The newly created EventFee</returns>
 public EventFee PostEventFee(string eventId, EventFee eventFee)
 {
     if (string.IsNullOrWhiteSpace(eventId))
     {
         throw new IllegalArgumentException(Config.Errors.InvalidId);
     }
     if (eventFee == null)
     {
         throw new IllegalArgumentException(Config.Errors.ObjectNull);
     }
     return EventSpotService.PostEventFee(this.AccessToken, this.APIKey, eventId, eventFee);
 }
Esempio n. 2
0
        /// <summary>
        /// Create an individual event fee
        /// </summary>
        /// <param name="eventId">Event id</param>
        /// <param name="eventFee">EventFee object</param>
        /// <returns>The newly created EventFee</returns>
        public EventFee PostEventFee(string eventId, EventFee eventFee)
        {
            if (string.IsNullOrWhiteSpace(eventId))
            {
                throw new IllegalArgumentException(CTCT.Resources.Errors.InvalidId);
            }
            if (eventFee == null)
            {
                throw new IllegalArgumentException(CTCT.Resources.Errors.ObjectNull);
            }

            string url = String.Format(String.Concat(Settings.Endpoints.Default.BaseUrl, Settings.Endpoints.Default.EventFees), eventId, null);

            string json = eventFee.ToJSON();

            RawApiResponse response = RestClient.Post(url, UserServiceContext.AccessToken, UserServiceContext.ApiKey, json);
            try
            {
                var evFee = response.Get<EventFee>();
                return evFee;
            }
            catch (Exception ex)
            {
                throw new CtctException(ex.Message, ex);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Create an individual event fee
        /// </summary>
        /// <param name="accessToken">Constant Contact OAuth2 access token</param>
        /// <param name="apiKey">The API key for the application</param>
        /// <param name="eventId">Event id</param>
        /// <param name="eventFee">EventFee object</param>
        /// <returns>The newly created EventFee</returns>
        public EventFee PostEventFee(string accessToken, string apiKey, string eventId, EventFee eventFee)
        {
            string url = String.Format(String.Concat(Config.Endpoints.BaseUrl, Config.Endpoints.EventFees), eventId, null);

            string json = eventFee.ToJSON();

            CUrlResponse response = RestClient.Post(url, accessToken, apiKey, json);
            if (response.HasData)
            {
                return response.Get<EventFee>();
            }
            else if (response.IsError)
            {
                throw new CtctException(response.GetErrorMessage());
            }
            return new EventFee();
        }