Exemple #1
0
        public HttpResponseMessage GetEventDetailsByRef(string refId)
        {
            GetEventDetailsByRefResponse responseData = null;

            try
            {
                //Authenticate API key
                long?hostId = HostServices.GetCallerHostId();
                if (!hostId.HasValue)
                {
                    Log.Warn(ResponseMessages.InvalidAPIKey);
                    return(Request.CreateResponse(new GenericResponse(null, ResponseCodes.InvalidAPIKey, ResponseMessages.InvalidAPIKey)));
                }

                //Get event
                EventsServices eventsService = new EventsServices();
                var            eventInfo     = eventsService.GetEventByRef(hostId.Value, refId);
                if (eventInfo != null)
                {
                    //Get tiers
                    var tiers = eventsService.GetEventTiersByEventId(eventInfo.EventId.Value);

                    responseData       = new GetEventDetailsByRefResponse();
                    responseData.Event = eventInfo;
                    responseData.Tiers = tiers;
                }

                //Send response
                return(Request.CreateResponse(new GenericResponse(responseData, ResponseCodes.Success, ResponseMessages.Success)));
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
                return(Request.CreateResponse(new GenericResponse(null, ResponseCodes.Error, ResponseMessages.Error)));
            }
        }