Пример #1
0
 public UserDao(IConfiguration config)
 {
     base._configuracoes = config;
     user   = new User();
     tkdao  = new TokenDao(_configuracoes);
     actdao = new ActivityDao(_configuracoes);
 }
Пример #2
0
        public User GetUser(string authorization)
        {
            UserDao  userdao = new UserDao(_configuracoes);
            TokenDao tkdao   = new TokenDao(_configuracoes);

            if (!string.IsNullOrEmpty(authorization))
            {
                try
                {
                    int uid  = Convert.ToInt32(tkdao.DecodeToken(authorization).uid);
                    var user = userdao.GetById(uid);

                    if (user.id > 0)
                    {
                        return(user);
                    }
                }
                catch (Exception ex)
                {
                    jsh.addAlert("error", ex.Message);
                }
            }
            return(null);
        }