Ejemplo n.º 1
0
        public HttpResponseMessage GetExample(int exampleId)
        {
            try
            {
                var example  = ExampleDataAccess.GetItem(exampleId, ActiveModule.ModuleID);
                var response = new ServiceResponse <ExampleInfo> {
                    Content = example
                };

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

                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 GetCurrentUser()
        {
            try
            {
                var currentUser = UserInfo;
                var response    = new ServiceResponse <UserInfo> {
                    Content = UserInfo
                };

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

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