Example #1
0
        public void Execute()
        {
            this.logger.RunWithExceptionLogging(() =>
            {
                this.tradeTable.Draw(portfoliosService.GetAllPortfolios());
            });

            this.logger.WriteMessage("Got all portfolios from portfolios base.");
        }
Example #2
0
        public HttpResponseMessage Get()
        {
            int clientId;
            var parameters = System.Web.HttpUtility.ParseQueryString(Request.RequestUri.Query);
            IEnumerable <string> result = new List <string>();

            if (!parameters.AllKeys.Any(x => x == "clientId"))
            {
                return(Request.CreateResponse(new ArgumentException($"{Request.RequestUri.Query} does not contains required command.")));
            }

            if (!int.TryParse(parameters.Get("clientId"), out clientId))
            {
                return(Request.CreateResponse(new ArgumentException($"{Request.RequestUri.Query} clientId should be an integer.")));
            }
            var clientShares = portfoliosService.GetAllPortfolios().Where(x => x.ClientID == clientId).ToList();

            return(Request.CreateResponse(HttpStatusCode.OK, clientShares));
        }