Ejemplo n.º 1
0
        public GetCurrentUserResponse GetCurrentUser(GetCurrentUserRequest request)
        {
            GetCurrentUserResponse    response = new GetCurrentUserResponse();
            SecurityBusinessComponent bc       = DependencyInjectionHelper.GetSecurityBusinessComponent();

            User user = bc.GetUserByName(Thread.CurrentPrincipal.Identity.Name);

            response.User = SecurityAdapter.UserToCurrentUserDTO(user);

            return(response);
        }
Ejemplo n.º 2
0
 public CurrentUserDTO GetCurrentUser()
 {
     try
     {
         GetCurrentUserResponse response = Service.GetCurrentUser(new GetCurrentUserRequest());
         return(response.User);
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, "PL Policy"))
         {
             throw;
         }
         return(new CurrentUserDTO());
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetCurrentUserResponse response = new GetCurrentUserResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("User", targetDepth))
                {
                    var unmarshaller = UserUnmarshaller.Instance;
                    response.User = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }