Exemplo n.º 1
0
        public ActionResult GetListArtice(ArticeIndexModel model)
        {
            PopulateIndexModel(model);

            return JsonObject(true, string.Empty, new
            {
                html = PartialViewToString("_list", model)
            });
        }
Exemplo n.º 2
0
 public ActionResult Index(ArticeIndexModel model)
 {
     PopulateIndexModel(model);
     return View(model);
 }
Exemplo n.º 3
0
        private void PopulateIndexModel(ArticeIndexModel model)
        {
            model.InitSortInfo();

            if (string.IsNullOrWhiteSpace(model.SortBy))
            {
                model.SortBy = "Name";
            }

            var filter = new FindRequest
            {
                TextSearch = model.TextSearch,
                SortOption = new SortOption(new[] { new SortItem(model.SortBy, model.SortDirection.Value) }),
                PageOption = new PageOption { PageSize = model.Pagination.PageSize, PageNumber = model.Pagination.CurrentPageIndex }
            };

            var response = ServiceHelper.Artice.ExecuteDispose(s => s.FindArtices(filter));
            model.Results = response.Results.MapList<ArticeModel>();
            model.Pagination.TotalRecords = response.TotalRecords;
        }