Ejemplo n.º 1
0
        public HttpResponseMessage UpdateSessionRegistration(SessionRegistrationInfo registration)
        {
            try
            {
                SessionRegistrationDataAccess.UpdateItem(registration);

                var savedRegistration = SessionRegistrationDataAccess.GetItems(registration.SessionId).FirstOrDefault(r => r.RegistrationId == registration.RegistrationId);

                var response = new ServiceResponse <SessionRegistrationInfo> {
                    Content = savedRegistration
                };

                return(Request.CreateResponse(HttpStatusCode.OK, response.ObjectToJson()));
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ERROR_MESSAGE));
            }
        }
Ejemplo n.º 2
0
        public HttpResponseMessage GetSessionRegistrations(int sessionId)
        {
            try
            {
                var registrations = SessionRegistrationDataAccess.GetItems(sessionId);
                var response      = new ServiceResponse <List <SessionRegistrationInfo> > {
                    Content = registrations.ToList()
                };

                if (registrations == null)
                {
                    ServiceResponseHelper <List <SessionRegistrationInfo> > .AddNoneFoundError("registrations", ref response);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, response.ObjectToJson()));
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ERROR_MESSAGE));
            }
        }
Ejemplo n.º 3
0
        public HttpResponseMessage GetSessionRegistrationByRegistrantId(int sessionId, int registrantId)
        {
            try
            {
                var registration = SessionRegistrationDataAccess.GetItems(sessionId).FirstOrDefault(r => r.RegistrationId == registrantId);
                var response     = new ServiceResponse <SessionRegistrationInfo> {
                    Content = registration
                };

                if (registration == null)
                {
                    ServiceResponseHelper <SessionRegistrationInfo> .AddNoneFoundError("registration", ref response);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, response.ObjectToJson()));
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ERROR_MESSAGE));
            }
        }