コード例 #1
0
        public ActionResult TradeSignal()
        {
            try
            {
                FillTradeSignalDataCombobox();
                using (var ctx = DatabaseContext.Instance.Make())
                {
                    var allItems = ctx.SERVICE.Select(x => new TradeSignalModel
                        {
                            ID = x.ID,
                            User = x.User,
                            Comment = x.Comment,
                            Currency = x.Currency,
                            AccountId = x.AccountId,
                            FixedPrice = x.FixedPrice,
                            ServiceType = x.ServiceType,
                            UserLogin = x.PLATFORM_USER.Login,
                            СountSubscriber = x.SUBSCRIPTION.Count
                        }).ToList();

                    var pageItems = new PagedList<TradeSignalModel>(allItems, 0, 10);
                    var model = new TradeSignalListModel
                        {
                            CurrentPageItems = pageItems,
                            CurrentPageSize = 10,
                            PageNomber = 0
                        };

                    if (Request.IsAjaxRequest())
                        return PartialView("TradeSignalPartialTable", model);
                    return View("TradeSignal", model);
                }
            }
            catch (Exception ex)
            {
                Logger.Info("PartialSpot - не удалось получить данные с сервера", ex);
                return null;
            }
        }
コード例 #2
0
        public ActionResult TradeSignal(TradeSignalListModel model, string pageUserAction, string pageUserArg)
        {
            FillTradeSignalDataCombobox();
            using (var ctx = DatabaseContext.Instance.Make())
            {
                var allItems = ctx.SERVICE.Select(x => new TradeSignalModel
                    {
                        ID = x.ID,
                        User = x.User,
                        Comment = x.Comment,
                        Currency = x.Currency,
                        AccountId = x.AccountId,
                        FixedPrice = x.FixedPrice,
                        ServiceType = x.ServiceType,
                        UserLogin = x.PLATFORM_USER.Login,
                        СountSubscriber = x.SUBSCRIPTION.Count
                    }).ToList();

                if (!string.IsNullOrEmpty(model.SignallerFilterText))
                    allItems = allItems.Where(x => x.UserLogin.Contains(model.SignallerFilterText.Trim())).ToList();

                switch (pageUserAction)
                {
                    case "Paging":
                        model.PageNomber = String.IsNullOrEmpty(pageUserArg) ? 0 : Convert.ToInt32(pageUserArg);
                        break;
                }

                var pageItems = new PagedList<TradeSignalModel>(allItems, model.PageNomber, model.CurrentPageSize);

                ModelState.Remove("PageNomber");

                var newModel = new TradeSignalListModel
                    {
                        CurrentPageItems = pageItems,
                        PageNomber = pageItems.PageIndex
                    };

                if (Request.IsAjaxRequest())
                    return PartialView("TradeSignalPartialTable", newModel);
                return View("TradeSignal", newModel);
            }
        }