Ejemplo n.º 1
0
        public async Task <IHttpActionResult> GetUserByToken(string token)
        {
            using (var security = ObjectFactory.SecurityManager)
            {
                if (string.IsNullOrEmpty(token))
                {
                    return(BadRequest("Provide data"));
                }

                var user = await security.GetUser(token);

                if (user == null)
                {
                    return(NotFound());
                }
                return(Ok <Models.Common.BaseResponse <Models.Security.GlobalUser> >(
                           new Models.Common.BaseResponse <GlobalUser>()
                {
                    Data = GlobalUser.Marshall(user),
                    Status = "OK"
                }
                           ));
            }
        }