예제 #1
0
        // api/saft/TotalNetSales?arg1=2016-01-01&arg2=2017-01-01
        // api/saft/SalesInvoices?arg1=2016-01-01&arg2=2017-01-01
        // api/saft/Top10Products?arg1=2016-01-01&arg2=2017-01-01
        // api/saft/Top10Customers?arg1=2016-01-01&arg2=2017-01-01
        // api/saft/BalanceSheet?arg1=2016-01-01&arg2=2017-01-01
        // api/saft/IncomeStatement?arg1=2016-01-01&arg2=2017-01-01
        // api/saft/FinancialRatios?arg1=2016-01-01&arg2=2017-01-01
        // api/saft/NetIncome?arg1=2016-01-01&arg2=2017-01-01
        // api/saft/ReceivableVSPayable?arg1=2016-01-01&arg2=2017-01-01
        // api/saft/TurnOver?arg1=2016-01-01&arg2=2017-01-01
        public HttpResponseMessage Get(string id, string arg1, string arg2)
        {
            HttpResponseMessage response = null;
            string body = "";


            switch (id)
            {
            case "TotalNetSales":
                body = MongoConnection.GetTotalNetSales(arg1, arg2);
                break;

            case "SalesInvoices":
                body = MongoConnection.GetCollectionByDate("Invoices", "InvoiceDate", arg1, arg2);
                break;

            case "Top10Products":
                body = MongoConnection.GetTop10Products(arg1, arg2);
                break;

            case "Top10Customers":
                body = MongoConnection.GetTop10Customers(arg1, arg2);
                break;

            case "BalanceSheet":
                body = MongoConnection.GetBalanceSheet(arg1, arg2);
                break;

            case "IncomeStatement":
                body = MongoConnection.GetIncomeStatement(arg1, arg2);
                break;

            case "FinancialRatios":
                body = MongoConnection.GetFinancialRatios(arg1, arg2);
                break;

            case "NetIncome":
                body = MongoConnection.GetNetIncome(arg1, arg2);
                break;

            case "ReceivableVSPayable":
                body = MongoConnection.GetReceivableVSPayable(arg1, arg2);
                break;

            case "NetIncomeChart":
                body = MongoConnection.GetRurnOver(arg1, arg2);
                break;
            }

            response         = this.Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent(body, Encoding.UTF8, "application/json");

            return(response);
        }