示例#1
0
        public HttpResponseMessage Get(int userId)
        {
            try
            {
                UserModel userModel = _userService.GetUser(userId);

                int           photoCount = _photoService.PhotoCount(userId);
                int           albumCount = _albumService.AlbumsCount(userId);
                UserViewModel viewModel  = userModel.ToUserViewModel(photoCount, albumCount);

                return(Request.CreateResponse(HttpStatusCode.OK, viewModel, new JsonMediaTypeFormatter()));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }