コード例 #1
0
        public ActionResult GetUserById(int userId)
        {
            var request = new GetUserByIdRequest { UserId = userId };
            var response = this.membershipService.GetUserById(request);
            var result = response.ConvertToUsersInRoleViewModel();

            var jsonNetResult = new JsonNetResult
            {
                Formatting = (Formatting)Newtonsoft.Json.Formatting.Indented,
                Data = result
            };
            return jsonNetResult;
        }
コード例 #2
0
        /// <summary>
        /// The get user by id.
        /// </summary>
        /// <param name="request">
        /// The request.
        /// </param>
        /// <returns>
        /// The <see cref="GetUserByIdResponse"/>.
        /// </returns>
        public GetUserByIdResponse GetUserById(GetUserByIdRequest request)
        {
            var user = this.userRepository.GetUserById(request.UserId);
            if (user == null)
            {
                return new GetUserByIdResponse { MessageType = MessageType.Warning, Message = CommonResources.UserNotFound };
            }

            var result = user.ConvertToGetUserByIdResponse();
            return result;
        }