示例#1
0
        public async Task <JsonResult> GetAllMarketSetupData()
        {
            JsonResult json = null;

            try
            {
                var list = await MarketBal.GetMarketData();

                var categories = await MarketBal.GetActiveMarketCategories();

                json = new JsonResult
                {
                    Data = new
                    {
                        list                    = list,
                        categories              = categories,
                        livePortfolio1          = list.Where(a => a.ProductTypeID.Equals("104")),
                        lastCompletedTradesMain = list.Where(a => a.ExitDate.HasValue && a.ProductTypeID.Equals("105")).OrderBy(n => n.ExitDate).Take(10),
                    },
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                };
            }
            catch (WebException ex) //if server is off it will throw exeception and here we need notify user
            {
                throw ex;
            }

            return(json);
        }
示例#2
0
        public async Task <JsonResult> GetMarketSetDataByType(string typeId)
        {
            JsonResult json = null;

            try
            {
                var list = await MarketBal.GetMarketData(typeId);

                json = new JsonResult
                {
                    Data = list,
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                };
            }
            catch (WebException ex) //if server is off it will throw exeception and here we need notify user
            {
                throw ex;
            }

            return(json);
        }