Exemplo n.º 1
0
        public void ListAccountsForUser(HttpListenerContext context)
        {
            try
            {
                var data = GetRequestPostData(context.Request);
                var user = AuthenticateUser(data);

                if (user != null)
                {
                    var accountList = accountData.GetAccountsForUser(user);
                    SendJsonResponse(context, accountList);
                }
                else
                {
                    SendInvalidAuth(context);
                }
            }
            catch (RequestException e)
            {
                SendUnexpectedError(context, e.Reason);
            }
            catch (InputException e)
            {
                SendMissingParameter(context, e.Reason);
            }
        }