コード例 #1
0
        public HttpResponseMessage Get(int id)
        {
            if (id != null)
            {
                var user = _appUserRepository.GetAppUserById(id);
                if (user != null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, user));
                }

                throw new ApiDataException(1001, "No user found for this id.", HttpStatusCode.NotFound);
            }
            throw new ApiException()
                  {
                      ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = "Bad Request..."
                  };
        }