Esempio n. 1
0
        public Session GetSession(string token)
        {
            using (var _db = new ApplicationDbContext())
            {
                Session response = _sService.GetSession(_db, token);

                return(response);
            }
        }
Esempio n. 2
0
        public IHttpActionResult GetUserEmail(string token)
        {
            using (var _db = new ApplicationDbContext())
            {
                SessionServ _sessionService = new SessionServ();
                try
                {
                    var session = _sessionService.GetSession(_db, token);
                    if (session == null)
                    {
                        return(Content(HttpStatusCode.NotFound, "Session is no longer available."));
                    }
                    UserManager _userManager = new UserManager();

                    var user = _userManager.GetUser(session.UId);
                    return(Ok(user));
                }
                catch (Exception ex)
                {
                    return(Content(HttpStatusCode.InternalServerError, ex));
                }
            }
        }