예제 #1
0
        public async Task <HttpResponseMessage> Get()
        {
            Request.RegisterForDispose((IDisposable)_shopManager);
            var token           = Request.Headers.Authorization.Parameter;
            var isAuthenticated = _authenticationService.ValidateToken(token, out string username);

            if (await isAuthenticated)
            {
                try
                {
                    var shops = _shopManager.GetAllUserShops(username);
                    return(HelperClass.JsonHttpResponse(shops));
                }
                catch (NullReferenceException)
                {
                    return(HelperClass.JsonHttpResponse <Object>(null));
                }
            }
            else
            {
                return(new HttpResponseMessage(System.Net.HttpStatusCode.Unauthorized));
            }
        }