Example #1
0
        public HttpResponseMessage DeleteSessionRegistration(int itemId, int sessionId)
        {
            try
            {
                SessionRegistrationDataAccess.DeleteItem(itemId, sessionId);

                var response = new ServiceResponse <string> {
                    Content = SUCCESS_MESSAGE
                };

                return(Request.CreateResponse(HttpStatusCode.OK, response.ObjectToJson()));
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ERROR_MESSAGE));
            }
        }
Example #2
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));
            }
        }
Example #3
0
        public HttpResponseMessage GetSessionRegistration(int itemId, int sessionId)
        {
            try
            {
                var registration = SessionRegistrationDataAccess.GetItem(itemId, sessionId);
                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));
            }
        }